summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-05 12:30:14 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-05 12:30:14 (GMT)
commit20218cbb57a368c2d6981ca7001c6202ed885c24 (patch)
tree39eb3afa1e41ef2f837843ac380e8c8c942a916d /src/gui/widgets
parentc3414bde059f8034d44df8a87d6ae95ff3481a93 (diff)
parent1e10fced4ceb59455b19f5e054b480f91aad273d (diff)
downloadQt-20218cbb57a368c2d6981ca7001c6202ed885c24.zip
Qt-20218cbb57a368c2d6981ca7001c6202ed885c24.tar.gz
Qt-20218cbb57a368c2d6981ca7001c6202ed885c24.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: WinCE: QMenuBar::triggered(QAction*) was emitted too often coding style changes in qmenu_wince.cpp
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/qmenu_wince.cpp134
1 files changed, 82 insertions, 52 deletions
diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp
index 1577f0a..37ff4c4 100644
--- a/src/gui/widgets/qmenu_wince.cpp
+++ b/src/gui/widgets/qmenu_wince.cpp
@@ -133,7 +133,8 @@ static void qt_wce_disable_soft_key(HWND handle, uint command)
ptrEnableSoftKey(handle, command, false, false);
}
-static void qt_wce_delete_action_list(QList<QWceMenuAction*> *list) {
+static void qt_wce_delete_action_list(QList<QWceMenuAction*> *list)
+{
for(QList<QWceMenuAction*>::Iterator it = list->begin(); it != list->end(); ++it) {
QWceMenuAction *action = (*it);
delete action;
@@ -143,7 +144,8 @@ static void qt_wce_delete_action_list(QList<QWceMenuAction*> *list) {
}
//search for first QuitRole in QMenuBar
-static QAction* qt_wce_get_quit_action(QList<QAction *> actionItems) {
+static QAction* qt_wce_get_quit_action(QList<QAction *> actionItems)
+{
QAction *returnAction = 0;
for (int i = 0; i < actionItems.size(); ++i) {
QAction *action = actionItems.at(i);
@@ -158,7 +160,8 @@ static QAction* qt_wce_get_quit_action(QList<QAction *> actionItems) {
return 0; //nothing found;
}
-static QAction* qt_wce_get_quit_action(QList<QWceMenuAction*> actionItems) {
+static QAction* qt_wce_get_quit_action(QList<QWceMenuAction*> actionItems)
+{
for (int i = 0; i < actionItems.size(); ++i) {
if (actionItems.at(i)->action->menuRole() == QAction::QuitRole)
return actionItems.at(i)->action;
@@ -171,7 +174,8 @@ static QAction* qt_wce_get_quit_action(QList<QWceMenuAction*> actionItems) {
return 0;
}
-static HMODULE qt_wce_get_module_handle() {
+static HMODULE qt_wce_get_module_handle()
+{
HMODULE module = 0; //handle to resources
if (!(module = GetModuleHandle(L"QtGui4"))) //release dynamic
if (!(module = GetModuleHandle(L"QtGuid4"))) //debug dynamic
@@ -180,7 +184,8 @@ static HMODULE qt_wce_get_module_handle() {
return module;
}
-static void qt_wce_change_command(HWND menuHandle, int item, int command) {
+static void qt_wce_change_command(HWND menuHandle, int item, int command)
+{
TBBUTTONINFOA tbbi;
memset(&tbbi,0,sizeof(tbbi));
tbbi.cbSize = sizeof(tbbi);
@@ -189,7 +194,8 @@ TBBUTTONINFOA tbbi;
SendMessage(menuHandle, TB_SETBUTTONINFO, item, (LPARAM)&tbbi);
}
-static void qt_wce_rename_menu_item(HWND menuHandle, int item, const QString &newText) {
+static void qt_wce_rename_menu_item(HWND menuHandle, int item, const QString &newText)
+{
TBBUTTONINFOA tbbi;
memset(&tbbi,0,sizeof(tbbi));
tbbi.cbSize = sizeof(tbbi);
@@ -200,7 +206,8 @@ static void qt_wce_rename_menu_item(HWND menuHandle, int item, const QString &ne
SendMessage(menuHandle, TB_SETBUTTONINFO, item, (LPARAM)&tbbi);
}
-static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, int toolbarID, int flags = 0) {
+static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, int toolbarID, int flags = 0)
+{
resolveAygLibs();
if (ptrCreateMenuBar) {
@@ -225,8 +232,8 @@ static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, i
return 0;
}
-static void qt_wce_insert_action(HMENU menu, QWceMenuAction *action, bool created) {
-
+static void qt_wce_insert_action(HMENU menu, QWceMenuAction *action, bool created)
+{
Q_ASSERT_X(menu, "AppendMenu", "menu is 0");
if (action->action->isVisible()) {
int flags;
@@ -265,12 +272,14 @@ static void qt_wce_clear_menu(HMENU hMenu)
This function refreshes the native Windows CE menu.
*/
-void QMenuBar::wceRefresh() {
+void QMenuBar::wceRefresh()
+{
for (int i = 0; i < nativeMenuBars.size(); ++i)
nativeMenuBars.at(i)->d_func()->wceRefresh();
}
-void QMenuBarPrivate::wceRefresh() {
+void QMenuBarPrivate::wceRefresh()
+{
DrawMenuBar(wce_menubar->menubarHandle);
}
@@ -280,7 +289,8 @@ void QMenuBarPrivate::wceRefresh() {
This function sends native Windows CE commands to Qt menus.
*/
-QAction* QMenu::wceCommands(uint command) {
+QAction* QMenu::wceCommands(uint command)
+{
Q_D(QMenu);
return d->wceCommands(command);
}
@@ -292,22 +302,23 @@ QAction* QMenu::wceCommands(uint command) {
and all their child menus.
*/
-void QMenuBar::wceCommands(uint command, HWND) {
+void QMenuBar::wceCommands(uint command, HWND)
+{
for (int i = 0; i < nativeMenuBars.size(); ++i)
nativeMenuBars.at(i)->d_func()->wceCommands(command);
}
-bool QMenuBarPrivate::wceEmitSignals(QList<QWceMenuAction*> actions, uint command) {
+bool QMenuBarPrivate::wceEmitSignals(QList<QWceMenuAction*> actions, uint command)
+{
QAction *foundAction = 0;
for (int i = 0; i < actions.size(); ++i) {
- if (foundAction)
- break;
QWceMenuAction *action = actions.at(i);
if (action->action->menu()) {
foundAction = action->action->menu()->wceCommands(command);
+ if (foundAction)
+ break;
}
else if (action->command == command) {
- emit q_func()->triggered(action->action);
action->action->activate(QAction::Trigger);
return true;
}
@@ -319,13 +330,14 @@ bool QMenuBarPrivate::wceEmitSignals(QList<QWceMenuAction*> actions, uint comman
return false;
}
-void QMenuBarPrivate::wceCommands(uint command) {
+void QMenuBarPrivate::wceCommands(uint command)
+{
if (wceClassicMenu) {
for (int i = 0; i < wce_menubar->actionItemsClassic.size(); ++i)
wceEmitSignals(wce_menubar->actionItemsClassic.at(i), command);
} else {
if (wceEmitSignals(wce_menubar->actionItems, command)) {
- return ;
+ return;
}
else if (wce_menubar->leftButtonIsMenu) {//check if command is on the left quick button
wceEmitSignals(wce_menubar->actionItemsLeftButton, command);
@@ -337,7 +349,8 @@ void QMenuBarPrivate::wceCommands(uint command) {
}
}
-QAction *QMenuPrivate::wceCommands(uint command) {
+QAction *QMenuPrivate::wceCommands(uint command)
+{
QAction *foundAction = 0;
for (int i = 0; i < wce_menu->actionItems.size(); ++i) {
if (foundAction)
@@ -347,7 +360,7 @@ QAction *QMenuPrivate::wceCommands(uint command) {
foundAction = action->action->menu()->d_func()->wceCommands(command);
}
else if (action->command == command) {
- action->action->activate(QAction::Trigger);
+ activateAction(action->action, QAction::Trigger);
return action->action;
}
}
@@ -356,8 +369,8 @@ QAction *QMenuPrivate::wceCommands(uint command) {
return foundAction;
}
-void QMenuBarPrivate::wceCreateMenuBar(QWidget *parent) {
-
+void QMenuBarPrivate::wceCreateMenuBar(QWidget *parent)
+{
Q_Q(QMenuBar);
wce_menubar = new QWceMenuBarPrivate(this);
@@ -371,21 +384,25 @@ void QMenuBarPrivate::wceCreateMenuBar(QWidget *parent) {
wceClassicMenu = (!qt_wince_is_smartphone() && !qt_wince_is_pocket_pc());
}
-void QMenuBarPrivate::wceDestroyMenuBar() {
+void QMenuBarPrivate::wceDestroyMenuBar()
+{
Q_Q(QMenuBar);
int index = nativeMenuBars.indexOf(q);
nativeMenuBars.removeAt(index);
- if (wce_menubar)
- delete wce_menubar;
- wce_menubar = 0;
+ if (wce_menubar) {
+ delete wce_menubar;
+ wce_menubar = 0;
+ }
}
-QMenuBarPrivate::QWceMenuBarPrivate::QWceMenuBarPrivate(QMenuBarPrivate *menubar) :
- menubarHandle(0), menuHandle(0),leftButtonMenuHandle(0) ,
- leftButtonAction(0), leftButtonIsMenu(false), d(menubar) {
+QMenuBarPrivate::QWceMenuBarPrivate::QWceMenuBarPrivate(QMenuBarPrivate *menubar)
+: menubarHandle(0), menuHandle(0), leftButtonMenuHandle(0),
+ leftButtonAction(0), leftButtonIsMenu(false), d(menubar)
+{
}
-QMenuBarPrivate::QWceMenuBarPrivate::~QWceMenuBarPrivate() {
+QMenuBarPrivate::QWceMenuBarPrivate::~QWceMenuBarPrivate()
+{
if (menubarHandle)
DestroyWindow(menubarHandle);
qt_wce_delete_action_list(&actionItems);
@@ -403,24 +420,28 @@ QMenuBarPrivate::QWceMenuBarPrivate::~QWceMenuBarPrivate() {
QMenuBar::wceRefresh();
}
-QMenuPrivate::QWceMenuPrivate::QWceMenuPrivate() {
- menuHandle = 0;
+QMenuPrivate::QWceMenuPrivate::QWceMenuPrivate()
+: menuHandle(0)
+{
}
-QMenuPrivate::QWceMenuPrivate::~QWceMenuPrivate() {
+QMenuPrivate::QWceMenuPrivate::~QWceMenuPrivate()
+{
qt_wce_delete_action_list(&actionItems);
if (menuHandle)
DestroyMenu(menuHandle);
}
-void QMenuPrivate::QWceMenuPrivate::addAction(QAction *a, QWceMenuAction *before) {
+void QMenuPrivate::QWceMenuPrivate::addAction(QAction *a, QWceMenuAction *before)
+{
QWceMenuAction *action = new QWceMenuAction;
action->action = a;
action->command = qt_wce_menu_static_cmd_id++;
addAction(action, before);
}
-void QMenuPrivate::QWceMenuPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before) {
+void QMenuPrivate::QWceMenuPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before)
+{
if (!action)
return;
int before_index = actionItems.indexOf(before);
@@ -439,9 +460,13 @@ void QMenuPrivate::QWceMenuPrivate::addAction(QWceMenuAction *action, QWceMenuAc
Windows CE menu bar bindings.
*/
-HMENU QMenu::wceMenu(bool create) { return d_func()->wceMenu(create); }
+HMENU QMenu::wceMenu(bool create)
+{
+ return d_func()->wceMenu(create);
+}
-HMENU QMenuPrivate::wceMenu(bool create) {
+HMENU QMenuPrivate::wceMenu(bool create)
+{
if (!wce_menu)
wce_menu = new QWceMenuPrivate;
if (!wce_menu->menuHandle || create)
@@ -464,25 +489,28 @@ void QMenuPrivate::QWceMenuPrivate::rebuild()
QMenuBar::wceRefresh();
}
-void QMenuPrivate::QWceMenuPrivate::syncAction(QWceMenuAction *) {
+void QMenuPrivate::QWceMenuPrivate::syncAction(QWceMenuAction *)
+{
rebuild();
}
-void QMenuPrivate::QWceMenuPrivate::removeAction(QWceMenuAction *action) {
- actionItems.removeAll(action);
- delete action;
- action = 0;
- rebuild();
+void QMenuPrivate::QWceMenuPrivate::removeAction(QWceMenuAction *action)
+{
+ actionItems.removeAll(action);
+ delete action;
+ rebuild();
}
-void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QWceMenuAction *before) {
+void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QWceMenuAction *before)
+{
QWceMenuAction *action = new QWceMenuAction;
action->action = a;
action->command = qt_wce_menu_static_cmd_id++;
addAction(action, before);
}
-void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before) {
+void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before)
+{
if (!action)
return;
int before_index = actionItems.indexOf(before);
@@ -494,25 +522,27 @@ void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QWceMenuAction *action, QWce
rebuild();
}
-void QMenuBarPrivate::QWceMenuBarPrivate::syncAction(QWceMenuAction*) {
+void QMenuBarPrivate::QWceMenuBarPrivate::syncAction(QWceMenuAction*)
+{
QMenuBar::wceRefresh();
rebuild();
}
-void QMenuBarPrivate::QWceMenuBarPrivate::removeAction(QWceMenuAction *action) {
+void QMenuBarPrivate::QWceMenuBarPrivate::removeAction(QWceMenuAction *action)
+{
actionItems.removeAll(action);
delete action;
- action = 0;
rebuild();
}
-void QMenuBarPrivate::_q_updateDefaultAction() {
+void QMenuBarPrivate::_q_updateDefaultAction()
+{
if (wce_menubar)
wce_menubar->rebuild();
}
-void QMenuBarPrivate::QWceMenuBarPrivate::rebuild() {
-
+void QMenuBarPrivate::QWceMenuBarPrivate::rebuild()
+{
d->q_func()->resize(0,0);
parentWindowHandle = d->q_func()->parentWidget() ? d->q_func()->parentWidget()->winId() : d->q_func()->winId();
if (d->wceClassicMenu) {