void ProgressDialog::slotToggleVisibility() { /* Since we are only hiding with a timeout, there is a short period of * time where the last item is still visible, but clicking on it in * the statusbarwidget should not display the dialog, because there * are no items to be shown anymore. Guard against that. */ mWasLastShown = !isShown(); if ( isShown() || !mTransactionsToListviewItems.isEmpty() ) setVisible( !isShown() ); }
void XFE_ReadAttachPanel::setPaneHeight(int height) { if (!getBaseWidget() || height<1 || height==getPaneHeight()) return; int wasShown=isShown(); // if panel is shown, we need to hide/show to force XmPanedWindow to // notice the height change if (wasShown) hide(); // XmPaned window hack to set height of a pane XtVaSetValues(getBaseWidget(), XmNpaneMinimum, height, XmNpaneMaximum, height, NULL); if (wasShown) show(); XtVaSetValues(getBaseWidget(), XmNpaneMinimum, 1, XmNpaneMaximum, 10000, NULL); }
void QMenuBar::performDelayedChanges() { #if defined(Q_WS_MAC) && !defined(QMAC_MENUBAR_NO_NATIVE) // I must do this here as the values change in the function below. bool needMacUpdate = (pendingDelayedContentsChanges || pendingDelayedStateChanges); #endif if( pendingDelayedContentsChanges ) performDelayedContentsChanged(); if( pendingDelayedStateChanges ) performDelayedStateChanged(); #if defined(Q_WS_MAC) && !defined(QMAC_QMENUBAR_NO_NATIVE) if(mac_eaten_menubar && needMacUpdate) { macDirtyNativeMenubar(); bool all_hidden = TRUE; if(irects) { for(int i = 0; all_hidden && i < (int)mitems->count(); i++) all_hidden = irects[i].isEmpty(); } if( all_hidden ) { if( !isHidden()) hide(); } else { if( !isShown() && !fromFrameChange ) show(); } } #endif }
void DatePlot::draw () { if (buffer.isNull()) return; buffer.fill(backgroundColor); if (dateList.count() && isShown()) { QPainter painter; painter.begin(&buffer); painter.setPen(borderColor); painter.setFont(plotFont); QFontMetrics fm(plotFont); int x = startX; int loop = startIndex; // clear date area painter.fillRect(0, buffer.height(), buffer.width() - scaleWidth, buffer.height(), backgroundColor); // draw the seperator line painter.drawLine (0, 0, buffer.width() - scaleWidth, 0); while(x <= (buffer.width() - scaleWidth) && loop < (int) dateList.count()) { TickItem *item = dateList.at(loop); if (item->flag) { if (! item->tick) { // draw the short tick painter.drawLine (x, 1, x, 4); painter.drawText (x - (fm.width(item->text, -1) / 2), fm.height() + 2, item->text, -1); } else { // draw the long tick painter.drawLine (x, 1, x, buffer.height() - fm.height() - 2); painter.drawText (x - (fm.width(item->text, -1) / 2), buffer.height() - 2, item->text, -1); } } x = x + pixelspace; loop++; } painter.end(); } update(); }
void SDLGwenOrgnismInspector::setOrganism(Organism* pOrg) { if(!isShown()) { show(pOrg); } else { org = pOrg; }; };
void RKComponent::propertyValueChanged (RKComponentPropertyBase *property) { RK_TRACE (PLUGIN); // slightly more elaborat than necessary on first thought, to prevent loops if (property == visibility_property) { if (visibility_property->boolValue ()) { if (!isShown ()) show (); } else { if (isShown ()) hide (); } } else if (property == enabledness_property) { updateEnablednessRecursive (); } else if (property == requiredness_property) { required = requiredness_property->boolValue (); changed (); } }
void SDLGwenOrgnismInspector::setBounds(int pPosX, int pPosY, int pDimX, int pDimY) { posX = pPosX; posY = pPosY; dimX = pDimX; dimY = pDimY; if(isShown()) { listBox->SetBounds(posX,posY,dimX,dimY); }; };
void KstDataManagerI::updateContents() { if (!isShown()) { return; } for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) { KstObjectItem *oi = static_cast<KstObjectItem*>(i); oi->update(); } }
void CXmlPropertyEditor::updateWindow() { if ( isHidden() && count() ) { parentWidget()->show(); MainWindow::self->setAppropriate( (QDockWindow*)parentWidget(), TRUE ); } else if ( isShown() && !count() ) { parentWidget()->hide(); MainWindow::self->setAppropriate( (QDockWindow*)parentWidget(), FALSE ); } }
bool AddFriendForm::addFriendRequest(const QString &friendAddress, const QString &message) { if (Settings::getInstance().addFriendRequest(friendAddress, message)) { addFriendRequestWidget(friendAddress, message); if (isShown()) onCurrentChanged(tabWidget->currentIndex()); return true; } return false; }
void KasBar::repaintItem(KasItem *i, bool erase ) { if ( !i ) return; if ( !isShown() ) return; QPainter p( &offscreen ); QPoint pos = i->pos(); paintBackground( &p, QRect( pos, QSize( itemExtent(), itemExtent() ) ) ); i->paint( &p, pos.x(), pos.y() ); repaint( QRect( pos, QSize( itemExtent(), itemExtent() ) ), transparent_ || erase ); }
void SDLGwenOrgnismInspector::show(Organism* pOrg) { if(isShown()) { hide(); } org = pOrg; listBox = new Gwen::Controls::ListBox(parentCanvas); listBox->SetBounds(posX, posY, dimX, dimY); listBox->AddItem("No Items Yet"); listBox->SetShouldDrawBackground(false); update(); };
void KasBar::updateItem( KasItem *i ) { if ( !i ) return; if ( !isShown() ) return; QPainter p( &offscreen ); QPoint pos = i->pos(); paintBackground( &p, QRect( pos, QSize( itemExtent(), itemExtent() ) ) ); i->paint( &p, pos.x(), pos.y() ); update( QRect( pos, QSize( itemExtent(), itemExtent() ) ) ); }
/** * Show/hide playlist global shortcut and PlayerWindow PlaylistButton connect to this slot * RULES: * 1. hidden & iconified -> deiconify & show @n * 2. hidden & deiconified -> show @n * 3. shown & iconified -> deiconify @n * 4. shown & deiconified -> hide @n * 5. don't hide if there is no tray icon or playerWindow. todo (I can't be arsed) @n * * @note isMinimized() can only be true if the window isShown() * this has taken me hours to get right, change at your peril! * there are more contingencies than you can believe */ void PlaylistWindow::showHide() //SLOT { const KWin::WindowInfo info = KWin::windowInfo( winId() ); const uint desktop = KWin::currentDesktop(); const bool isOnThisDesktop = info.isOnDesktop( desktop ); const bool isShaded = false; if( isShaded ) { KWin::clearState( winId(), NET::Shaded ); setShown( true ); } if( !isOnThisDesktop ) { KWin::setOnDesktop( winId(), desktop ); setShown( true ); } else if( !info.isMinimized() && !isShaded ) setShown( !isShown() ); if( isShown() ) KWin::deIconifyWindow( winId() ); }
void SDLGwenOrgnismInspector::update() { if(isShown()) { if(org == 0) { hide(); } else { listBox->Clear(); listBox->AddItem(org->getName().append(" (").append(Gwen::Utility::ToString(org->getRootBodypart()->getGeneticCode()->getSpeciesIdentifier())).append(")"))->SetTextColor(Gwen::Color(250,200,0,255)); listBox->AddItem(Gwen::Utility::ToString("gen: ").append(Gwen::Utility::ToString(org->getRootBodypart()->getGeneticCode()->getGeneration())))->SetTextColor(Gwen::Color(250,200,0,255)); listBox->AddItem(Gwen::Utility::ToString("fitness: ").append(Gwen::Utility::ToString(org->getFitnessValue())))->SetTextColor(Gwen::Color(250,200,0,255)); listBox->AddItem(Gwen::Utility::ToString("bp count: ").append(Gwen::Utility::ToString(org->getBodypartCount())))->SetTextColor(Gwen::Color(250,200,0,255)); listBox->AddItem(Gwen::Utility::ToString("lifetime: ").append(Gwen::Utility::ToString(org->getLifetime())))->SetTextColor(Gwen::Color(250,200,0,255)); } } };
void rkFrame::timerEvent(QTimerEvent *timer) { int id = timer->timerId(); if (id == timer1 && isShown()) { updateTime(); } else if (id == timer2) { screenOn(); } #if 0 if (id == keyTimer) { killTimer(id); keyRepeat = false; } #endif }
VirtualConsole::~VirtualConsole() { QString config; // // Save visible status // if (isShown()) { config = Settings::trueValue(); } else { config = Settings::falseValue(); } _app->settings()->set(KEY_VIRTUAL_CONSOLE_OPEN, config); }
// // Destructor // DeviceManagerView::~DeviceManagerView() { QString config; if (isShown()) { config = Settings::trueValue(); } else { config = Settings::falseValue(); } _app->settings()->set(KEY_DEVICE_MANAGER_OPEN, config); // // Save rect // _app->settings()->set(KEY_DEVICE_MANAGER_X, rect().x()); _app->settings()->set(KEY_DEVICE_MANAGER_Y, rect().y()); _app->settings()->set(KEY_DEVICE_MANAGER_W, rect().width()); _app->settings()->set(KEY_DEVICE_MANAGER_H, rect().height()); }
//BEGIN internal SLOTS void ThumbnailList::slotRequestVisiblePixmaps( int /*newContentsX*/, int newContentsY ) { // if an update is already scheduled or the widget is hidden, don't proceed if ( (m_delayTimer && m_delayTimer->isActive()) || !isShown() ) return; int vHeight = visibleHeight(), vOffset = newContentsY == -1 ? contentsY() : newContentsY; // scroll from the top to the last visible thumbnail m_visibleThumbnails.clear(); QValueList< PixmapRequest * > requestedPixmaps; QValueVector<ThumbnailWidget *>::iterator tIt = m_thumbnails.begin(), tEnd = m_thumbnails.end(); for ( ; tIt != tEnd; ++tIt ) { ThumbnailWidget * t = *tIt; int top = childY( t ) - vOffset; if ( top > vHeight ) break; if ( top + t->height() < 0 ) continue; // add ThumbnailWidget to visible list m_visibleThumbnails.push_back( t ); // if pixmap not present add it to requests if ( !t->page()->hasPixmap( THUMBNAILS_ID, t->pixmapWidth(), t->pixmapHeight() ) ) { PixmapRequest * p = new PixmapRequest( THUMBNAILS_ID, t->pageNumber(), t->pixmapWidth(), t->pixmapHeight(), THUMBNAILS_PRIO, true ); requestedPixmaps.push_back( p ); } } // actually request pixmaps if ( !requestedPixmaps.isEmpty() ) m_document->requestPixmaps( requestedPixmaps ); }
void issueLineToShipping::sIssue() { if (_qtyToIssue->toDouble() <= 0) { XMessageBox::message( (isShown() ? this : parentWidget()), QMessageBox::Warning, tr("Invalid Quantity to Issue to Shipping"), tr( "<p>Please enter a non-negative, non-zero value to indicate the amount " "of Stock you wish to Issue to Shipping for this Order Line." ), QString::null, QString::null, _snooze ); _qtyToIssue->setFocus(); return; } if(_requireInventory || ("SO" == _ordertype && _metrics->boolean("EnableSOReservations"))) { q.prepare("SELECT sufficientInventoryToShipItem(:ordertype, :orderitemid, :orderqty) AS result;"); q.bindValue(":ordertype", _ordertype); q.bindValue(":orderitemid", _itemid); if(!_requireInventory) q.bindValue(":orderqty", _qtyToIssue->toDouble()); q.exec(); if (q.first()) { int result = q.value("result").toInt(); if (result < 0) { ParameterList errp; if (_ordertype == "SO") errp.append("soitem_id", _itemid); else if (_ordertype == "TO") errp.append("toitem_id", _itemid); QString errs = "<? if exists(\"soitem_id\") ?>" "SELECT item_number, warehous_code " " FROM coitem, item, itemsite, whsinfo " " WHERE ((coitem_itemsite_id=itemsite_id)" " AND (itemsite_item_id=item_id)" " AND (itemsite_warehous_id=warehous_id)" " AND (coitem_id=<? value(\"soitem_id\") ?>));" "<? elseif exists(\"toitem_id\")?>" "SELECT item_number, tohead_srcname AS warehous_code " " FROM toitem, tohead, item " " WHERE ((toitem_item_id=item_id)" " AND (toitem_tohead_id=tohead_id)" " AND (toitem_id=<? value(\"toitem_id\") ?>));" "<? endif ?>" ; MetaSQLQuery errm(errs); q = errm.toQuery(errp); if (! q.first() && q.lastError().type() != QSqlError::None) systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); systemError(this, storedProcErrorLookup("sufficientInventoryToShipItem", result) .arg(q.value("item_number").toString()) .arg(q.value("warehous_code").toString()), __FILE__, __LINE__); return; } } else if (q.lastError().type() != QSqlError::None) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } } // check to see if we are over issuing ParameterList params; if (_ordertype == "SO") params.append("soitem_id", _itemid); else if (_ordertype == "TO") params.append("toitem_id", _itemid); params.append("qty", _qtyToIssue->toDouble()); QString sql = "<? if exists(\"soitem_id\") ?>" "SELECT (noNeg(coitem_qtyord - coitem_qtyshipped + coitem_qtyreturned) <" " (COALESCE(SUM(shipitem_qty), 0) + <? value(\"qty\") ?>)) AS overship" " FROM coitem LEFT OUTER JOIN" " ( shipitem JOIN shiphead" " ON ( (shipitem_shiphead_id=shiphead_id) AND (NOT shiphead_shipped) )" " ) ON (shipitem_orderitem_id=coitem_id)" " WHERE (coitem_id=<? value(\"soitem_id\") ?>)" " GROUP BY coitem_qtyord, coitem_qtyshipped, coitem_qtyreturned;" "<? elseif exists(\"toitem_id\") ?>" "SELECT (noNeg(toitem_qty_ordered - toitem_qty_shipped) <" " (COALESCE(SUM(shipitem_qty), 0) + <? value(\"qty\") ?>)) AS overship" " FROM toitem LEFT OUTER JOIN" " ( shipitem JOIN shiphead" " ON ( (shipitem_shiphead_id=shiphead_id) AND (NOT shiphead_shipped) )" " ) ON (shipitem_orderitem_id=toitem_id)" " WHERE (toitem_id=<? value(\"toitem_id\") ?>)" " GROUP BY toitem_qty_ordered, toitem_qty_shipped;" "<? endif ?>" ; MetaSQLQuery mql(sql); q = mql.toQuery(params); if (q.next() && q.value("overship").toBool()) { if(XMessageBox::message( (isShown() ? this : parentWidget()) , QMessageBox::Question, tr("Inventory Overshipped"), tr("<p>You have selected to ship more inventory than required. Do you want to continue?"), tr("Yes"), tr("No"), _snooze, 0, 1) == 1) return; } if (q.lastError().type() != QSqlError::None) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } XSqlQuery rollback; rollback.prepare("ROLLBACK;"); XSqlQuery issue; issue.exec("BEGIN;"); issue.prepare("SELECT issueToShipping(:ordertype, :lineitem_id, :qty, 0, :ts) AS result;"); issue.bindValue(":ordertype", _ordertype); issue.bindValue(":lineitem_id", _itemid); issue.bindValue(":qty", _qtyToIssue->toDouble()); issue.bindValue(":ts", _transTS); issue.exec(); if (issue.first()) { int result = issue.value("result").toInt(); if (result < 0) { rollback.exec(); systemError( this, storedProcErrorLookup("issueToShipping", result), __FILE__, __LINE__); return; } else { if (distributeInventory::SeriesAdjust(result, this) == XDialog::Rejected) { rollback.exec(); QMessageBox::information( this, tr("Issue to Shipping"), tr("Issue Canceled") ); return; } issue.exec("COMMIT;"); accept(); } } else if (issue.lastError().type() != QSqlError::None) { rollback.exec(); systemError(this, issue.lastError().databaseText(), __FILE__, __LINE__); return; } }
void KstDataManagerI::update() { if (!isShown()) { return; } QListViewItem *currentItem = DataView->selectedItem(); QPtrStack<QListViewItem> trash; KST::dataObjectList.lock().writeLock(); KST::vectorList.lock().writeLock(); KST::matrixList.lock().writeLock(); // garbage collect first for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) { KstObjectItem *oi = static_cast<KstObjectItem*>(i); if (i->rtti() == RTTI_OBJ_OBJECT) { if (KST::dataObjectList.findTag(oi->tag().tag()) == KST::dataObjectList.end()) { trash.push(i); } } else if (i->rtti() == RTTI_OBJ_DATA_MATRIX || i->rtti() == RTTI_OBJ_MATRIX || i->rtti() == RTTI_OBJ_STATIC_MATRIX) { if (KST::matrixList.findTag(oi->tag().tag()) == KST::matrixList.end()) { trash.push(i); } } else { if (KST::vectorList.findTag(oi->tag().tag()) == KST::vectorList.end()) { trash.push(i); } } } trash.setAutoDelete(true); DataView->blockSignals(true); trash.clear(); DataView->blockSignals(false); // update the data objects for (KstDataObjectList::iterator it = KST::dataObjectList.begin(); it != KST::dataObjectList.end(); ++it) { KstReadLocker dol(*it); bool found = false; for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) { KstObjectItem *oi = static_cast<KstObjectItem*>(i); if (oi->rtti() == RTTI_OBJ_OBJECT && oi->tag().tag() == (*it)->tag().tag()) { oi->update(); found = true; break; } } if (!found) { KstObjectItem *i = new KstObjectItem(DataView, *it, this); connect(i, SIGNAL(updated()), this, SLOT(doUpdates())); } } KST::dataObjectList.lock().unlock(); // update the data vectors KstRVectorList rvl = kstObjectSubList<KstVector,KstRVector>(KST::vectorList); for (KstRVectorList::iterator it = rvl.begin(); it != rvl.end(); ++it) { KstReadLocker vl(*it); bool found = false; for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) { KstObjectItem *oi = static_cast<KstObjectItem*>(i); if (oi->rtti() == RTTI_OBJ_DATA_VECTOR && oi->tag().tag() == (*it)->tag().tag()) { oi->update(true, 1); found = true; break; } } if (!found) { KstObjectItem *i = new KstObjectItem(DataView, *it, this, 1); connect(i, SIGNAL(updated()), this, SLOT(doUpdates())); } } // update the static vectors KstSVectorList svl = kstObjectSubList<KstVector,KstSVector>(KST::vectorList); for (KstSVectorList::iterator it = svl.begin(); it != svl.end(); ++it) { KstReadLocker vl(*it); bool found = false; for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) { KstObjectItem *oi = static_cast<KstObjectItem*>(i); if (oi->rtti() == RTTI_OBJ_STATIC_VECTOR && oi->tag().tag() == (*it)->tag().tag()) { oi->update(true, 1); found = true; break; } } if (!found) { KstObjectItem *i = new KstObjectItem(DataView, *it, this, 1); connect(i, SIGNAL(updated()), this, SLOT(doUpdates())); } } KST::vectorList.lock().unlock(); // update the data matrices KstRMatrixList rml = kstObjectSubList<KstMatrix,KstRMatrix>(KST::matrixList); for (KstRMatrixList::iterator it = rml.begin(); it != rml.end(); ++it) { KstReadLocker ml(*it); bool found = false; for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) { KstObjectItem *oi = static_cast<KstObjectItem*>(i); if (oi->rtti() == RTTI_OBJ_DATA_MATRIX && oi->tag().tag() == (*it)->tag().tag()) { oi->update(true, 1); found = true; break; } } if (!found) { KstObjectItem *i = new KstObjectItem(DataView, *it, this, 1); connect(i, SIGNAL(updated()), this, SLOT(doUpdates())); } } // update the static matrices KstSMatrixList sml = kstObjectSubList<KstMatrix,KstSMatrix>(KST::matrixList); for (KstSMatrixList::iterator it = sml.begin(); it != sml.end(); ++it) { KstReadLocker ml(*it); bool found = false; for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) { KstObjectItem *oi = static_cast<KstObjectItem*>(i); if (oi->rtti() == RTTI_OBJ_STATIC_MATRIX && oi->tag().tag() == (*it)->tag().tag()) { oi->update(true, 1); found = true; break; } } if (!found) { KstObjectItem *i = new KstObjectItem(DataView, *it, this, 1); connect(i, SIGNAL(updated()), this, SLOT(doUpdates())); } } KST::matrixList.lock().unlock(); // is this really necessary? I would think not... for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) { if (i == currentItem) { DataView->setCurrentItem(i); DataView->setSelected(i, true); break; } } if (DataView->selectedItem()) { static_cast<KstObjectItem*>(DataView->currentItem())->updateButtons(); } else { Edit->setEnabled(false); Delete->setEnabled(false); } }
void KstDataManagerI::update() { if (!isShown()) { return; } QPtrStack<QListViewItem> trash; // Garbage collect first for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) { KstObjectItem *oi = static_cast<KstObjectItem*>(i); if (i->rtti() == RTTI_OBJ_OBJECT) { if (KST::dataObjectList.findTag(oi->tagName()) == KST::dataObjectList.end()) { trash.push(i); } } else { if (KST::vectorList.findTag(oi->tagName()) == KST::vectorList.end()) { trash.push(i); } } } trash.setAutoDelete(true); trash.clear(); for (KstDataObjectList::iterator it = KST::dataObjectList.begin(); it != KST::dataObjectList.end(); ++it) { bool found = false; for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) { KstObjectItem *oi = static_cast<KstObjectItem*>(i); if (oi->rtti() == RTTI_OBJ_OBJECT && oi->tagName() == (*it)->tagName()) { oi->update(); found = true; break; } } if (!found) { KstObjectItem *i = new KstObjectItem(DataView, *it, this); connect(i, SIGNAL(updated()), this, SLOT(doUpdates())); } } KstRVectorList rvl = kstObjectSubList<KstVector,KstRVector>(KST::vectorList); for (KstRVectorList::iterator it = rvl.begin(); it != rvl.end(); ++it) { bool found = false; for (QListViewItem *i = DataView->firstChild(); i; i = i->nextSibling()) { KstObjectItem *oi = static_cast<KstObjectItem*>(i); if (oi->rtti() == RTTI_OBJ_DATA_VECTOR && oi->tagName() == (*it)->tagName()) { oi->update(); found = true; break; } } if (!found) { KstObjectItem *i = new KstObjectItem(DataView, *it, this); connect(i, SIGNAL(updated()), this, SLOT(doUpdates())); } } if (DataView->selectedItem()) { static_cast<KstObjectItem*>(DataView->currentItem())->updateButtons(); } else { Edit->setEnabled(false); Delete->setEnabled(false); } }
bool PlaylistWindow::isReallyShown() const { const KWin::WindowInfo info = KWin::windowInfo( winId() ); return isShown() && !info.isMinimized() && info.isOnDesktop( KWin::currentDesktop() ); }