void FloatyPlugin::unreadBlink() { m_bBlink = !m_bBlink; QList<QWidget *> list = QApplication::topLevelWidgets(); QListIterator<QWidget *> it(list); QWidget * w; while (it.hasNext()) { w = it.next(); if (w->inherits("FloatyWnd")){ FloatyWnd *wnd = static_cast<FloatyWnd*>(w); wnd->repaint(); } } }
void FloatyPlugin::unreadBlink() { m_bBlink = !m_bBlink; QWidgetList *list = QApplication::topLevelWidgets(); QWidgetListIt it(*list); QWidget * w; while ((w = it.current()) != NULL) { if (w->inherits("FloatyWnd")){ FloatyWnd *wnd = static_cast<FloatyWnd*>(w); wnd->repaint(); } ++it; } delete list; }
void *FloatyPlugin::processEvent(Event *e) { switch (e->type()){ case EventInit:{ Contact *contact; ContactList::ContactIterator it; while ((contact = ++it) != NULL){ FloatyUserData *data = (FloatyUserData*)(contact->userData.getUserData(user_data_id, false)); if (data == NULL) continue; FloatyWnd *wnd = new FloatyWnd(this, contact->id()); wnd->move(data->X.value, data->Y.value); wnd->show(); } break; } case EventCheckState:{ CommandDef *cmd = (CommandDef*)(e->param()); if (cmd->id == CmdFloaty){ Contact *contact = getContacts()->contact((unsigned)(cmd->param)); if (contact){ FloatyUserData *data = (FloatyUserData*)(contact->userData.getUserData(user_data_id, false)); if (data){ cmd->text = I18N_NOOP("Floating off"); cmd->flags |= COMMAND_CHECKED; }else{ cmd->text = I18N_NOOP("Floating on"); cmd->flags &= ~COMMAND_CHECKED; } } return e->param(); } break; } case EventCommandExec:{ CommandDef *cmd = (CommandDef*)(e->param()); if (cmd->id == CmdFloaty){ Contact *contact = getContacts()->contact((unsigned)(cmd->param)); if (contact){ FloatyUserData *data = (FloatyUserData*)(contact->userData.getUserData(user_data_id, false)); if (data){ FloatyWnd *wnd = findFloaty(contact->id()); if (wnd) delete wnd; contact->userData.freeUserData(user_data_id); }else{ data = (FloatyUserData*)(contact->userData.getUserData(user_data_id, true)); FloatyWnd *wnd = new FloatyWnd(this, (unsigned)(cmd->param)); wnd->move(0, 0); wnd->show(); } } return e->param(); } break; } case EventMessageDeleted: case EventMessageRead: case EventMessageReceived:{ Message *msg = (Message*)(e->param()); FloatyWnd *wnd = findFloaty(msg->contact()); if (wnd){ wnd->init(); wnd->repaint(); } break; } case EventContactClient: case EventContactStatus: case EventContactChanged:{ Contact *contact = (Contact*)(e->param()); FloatyWnd *wnd = findFloaty(contact->id()); if (wnd){ wnd->init(); wnd->repaint(); } break; } case EventContactOnline:{ Contact *contact = (Contact*)(e->param()); FloatyWnd *wnd = findFloaty(contact->id()); if (wnd) wnd->startBlink(); break; } case EventContactDeleted:{ Contact *contact = (Contact*)(e->param()); FloatyWnd *wnd = findFloaty(contact->id()); if (wnd) delete wnd; break; } case EventRepaintView:{ QWidgetList *list = QApplication::topLevelWidgets(); QWidgetListIt it(*list); QWidget * w; while ((w = it.current()) != NULL) { if (w->inherits("FloatyWnd")){ FloatyWnd *wnd = static_cast<FloatyWnd*>(w); wnd->init(); wnd->repaint(); } ++it; } delete list; break; } } return NULL; }