Toy* Toys::AddToy(Toy::EnumToyType type) { Toy *toy = Toy::Create(type, m_pClient, /*parent*/0, GetWindowFlags()); if( toy ) { connect(toy, SIGNAL(recvWidgetsChanged()), this, SLOT(onRecvWidgetsChanged())); connect(toy, SIGNAL(closing(Toy*)), this, SLOT(onToyClosing(Toy*))); connect(toy, SIGNAL(changed()), this, SLOT(onToyChanged())); connect(toy, SIGNAL(toggleMainWindow()), this, SLOT(onToyToggledMainWindow())); if(m_Opacity != 100) toy->setWindowOpacity(m_Opacity * 0.01); m_List.push_back(toy); if( !m_Loading ) { toy->showNormal(); BuildRecvWidgetsTable(); toy->raise(); } emit changed(); } return toy; }
void Toys::UpdateWindowFlags() { for(TOY_LIST::const_iterator i=m_List.begin(); i!=m_List.end(); i++) { Toy *toy = *i; QPoint pos( toy->frameGeometry().topLeft() ); Qt::WindowStates ws = toy->windowState(); bool wasVisible = toy->isVisible(); toy->hide(); toy->setWindowFlags( GetWindowFlags() ); if( ws.testFlag(Qt::WindowMinimized) ) { toy->showMinimized(); } else if( ws.testFlag(Qt::WindowMaximized) ) { toy->showMaximized(); if( !wasVisible ) toy->close(); } else { toy->move( pos ); toy->showNormal(); Toy::ClipToScreen( *toy ); if( !wasVisible ) toy->close(); } } }
void Toys::ActivateToy(size_t index) { if(index < m_List.size()) { Toy *toy = m_List[index]; Qt::WindowStates ws = toy->windowState(); if( ws.testFlag(Qt::WindowMaximized) ) toy->showMaximized(); else toy->showNormal(); toy->activateWindow(); } }