void RazorTaskBar::refreshTaskList() { XfitMan xf = xfitMan(); QList<Window> tmp = xf.getClientList(); //qDebug() << "** Fill ********************************"; //foreach (Window wnd, tmp) // if (xf->acceptWindow(wnd)) qDebug() << XfitMan::debugWindow(wnd); //qDebug() << "****************************************"; QMutableHashIterator<Window, RazorTaskButton*> i(mButtonsHash); while (i.hasNext()) { i.next(); int n = tmp.removeAll(i.key()); if (!n) { delete i.value(); i.remove(); } } foreach (Window wnd, tmp) { if (xf.acceptWindow(wnd)) { RazorTaskButton* btn = new RazorTaskButton(wnd, this); btn->setToolButtonStyle(mButtonStyle); if (buttonMaxWidth == -1) { btn->setMaximumWidth(btn->height()); } else { btn->setMaximumWidth(buttonMaxWidth); } mButtonsHash.insert(wnd, btn); // -1 is here due the last stretchable item mLayout->insertWidget(layout()->count()-1, btn); // now I want to set higher stretchable priority for buttons // to suppress stretchItem (last item) default value which // will remove that anoying aggresive space at the end -- petr mLayout->setStretch(layout()->count()-2, 1); } } refreshButtonVisibility(); activeWindowChanged(); }
void window_list::refreshTaskList() { XfitMan xf = xfitMan(); QList<Window> tmp = xf.getClientList(); //qDebug() << "** Fill ********************************"; //foreach (Window wnd, tmp) // if (xf->acceptWindow(wnd)) qDebug() << XfitMan::debugWindow(wnd); //qDebug() << "****************************************"; QMutableHashIterator<Window, InstanceOfWindow*> i(buttons); while (i.hasNext()) { i.next(); int n = tmp.removeAll(i.key()); if (!n) { //delete i.value(); i.value()->deleteLater(); i.remove(); } } foreach (Window wnd, tmp) { if (xf.acceptWindow(wnd)) { InstanceOfWindow* btn = new InstanceOfWindow(this,wnd); //btn->setToolButtonStyle(); buttons.insert(wnd, btn); // -1 is here due the last stretchable item layout->insertWidget(layout->count()-1, btn); // now I want to set higher stretchable priority for buttons // to suppress stretchItem (last item) default value which // will remove that anoying aggresive space at the end -- petr layout->setStretch(layout->count()-2, 1); //layout->addWidget(btn); } } setButtonMaxWidth(); refreshButtonVisibility(); activeWindowChanged(); }
void RazorTaskBar::wheelEvent(QWheelEvent* event) { XfitMan xf = xfitMan(); QList<Window> winList = xf.getClientList(); int current = winList.indexOf(xf.getActiveAppWindow()); int delta = event->delta() < 0 ? 1 : -1; for (int ix = current + delta; 0 <= ix && ix < winList.size(); ix += delta) { Window window = winList.at(ix); if (xf.acceptWindow(window) && windowOnActiveDesktop(window)) { xf.raiseWindow(window); break; } } }
void LxQtTaskBar::refreshTaskList() { XfitMan xf = xfitMan(); QList<Window> tmp = xf.getClientList(); //qDebug() << "** Fill ********************************"; //foreach (Window wnd, tmp) // if (xf->acceptWindow(wnd)) qDebug() << XfitMan::debugWindow(wnd); //qDebug() << "****************************************"; QMutableHashIterator<WId, LxQtTaskButton*> i(mButtonsHash); while (i.hasNext()) { i.next(); int n = tmp.removeAll(i.key()); if (!n) { // if the button we're removing is the currently selected app if(i.value() == mCheckedBtn) mCheckedBtn = NULL; delete i.value(); i.remove(); } } foreach (Window wnd, tmp) { if (xf.acceptWindow(wnd)) { LxQtTaskButton* btn = new LxQtTaskButton(wnd, this); btn->setStyle(mStyle); btn->setToolButtonStyle(mButtonStyle); mButtonsHash.insert(wnd, btn); mLayout->addWidget(btn); } } refreshButtonVisibility(); mLayout->invalidate(); activeWindowChanged(); realign(); }
void RazorTaskBar::refreshTaskList() { XfitMan xf = xfitMan(); QList<Window> tmp = xf.getClientList(); //qDebug() << "** Fill ********************************"; //foreach (Window wnd, tmp) // if (xf->acceptWindow(wnd)) qDebug() << XfitMan::debugWindow(wnd); //qDebug() << "****************************************"; QMutableHashIterator<Window, RazorTaskButton*> i(mButtonsHash); while (i.hasNext()) { i.next(); int n = tmp.removeAll(i.key()); if (!n) { delete i.value(); i.remove(); } } foreach (Window wnd, tmp) { if (xf.acceptWindow(wnd)) { RazorTaskButton* btn = new RazorTaskButton(wnd, this); btn->setToolButtonStyle(mButtonStyle); mButtonsHash.insert(wnd, btn); mLayout->addWidget(btn); } } refreshButtonVisibility(); mLayout->invalidate(); activeWindowChanged(); realign(); }