//virtual void AlphabetPage::slotLauncherCmdStartReorderMode() { //this is merely a notification from launcher that some page started reordering, so this page // should switch to reorder mode graphics. No actual reordering will start until this page itself // starts to be messed w/ directly by the user (see all the various functions for this in the .h file) setPageMode(PageMode::Reorder); }
//virtual void AlphabetPage::slotLauncherCmdEndReorderMode() { //This page type doesn't really have a reorder mode, so this is mainly just to swap the graphics back to no frames // and no badging. It's not as a complicated as ReorderablePage::slotLauncherCmdEndReorderMode(). (see that .cpp file) // However, one case does exist where a cleanup needs to be taken seriously: this page creates clones of icons it is // reordering, and if a clone doesn't make it to another page before an "end", then it could be lost (memory leak wise) // This is unlikely in Dfish so this will remain a // TODO: !!! setPageMode(PageMode::Normal); }
static void resetPosition() { /*shao CHIPSELECT(MODE_CMD) { spi_transfer_nr(0x22); spi_transfer_nr(0x00); spi_transfer_nr(0x07); spi_transfer_nr(0x21); spi_transfer_nr(0x00); spi_transfer_nr(0x7F); }*/ setPageMode(); setTextXY(0,0); setHorizontalMode(); delay(5); }
void SeeedOLED::drawBitmap(unsigned char *bitmaparray,int bytes) { char localAddressMode = addressingMode; if(addressingMode != HORIZONTAL_MODE) { //Bitmap is drawn in horizontal mode setHorizontalMode(); } for(int i=0;i<bytes;i++) { sendData(pgm_read_byte(&bitmaparray[i])); } if(localAddressMode == PAGE_MODE) { //If pageMode was used earlier, restore it. setPageMode(); } }
//virtual bool AlphabetPage::tapAndHoldGesture(QTapAndHoldGesture *tapHoldEvent,QGestureEvent * baseGestureEvent) { // qDebug() << __PRETTY_FUNCTION__ << ": Tap-N-Hold Gesture"; //if nothing is tracking, reject int mainTouchId; if (!anyTouchTracking(&mainTouchId)) { qDebug() << __PRETTY_FUNCTION__ << ": Rejected; touch FSM reports no touchId is currently tracked"; return true; } //TODO: MULTI-TOUCH: here is where I can get into deep trouble; I've just assumed that the main touch point is part of this gesture. It need not be if (!okToUseTapAndHold(mainTouchId)) { qDebug() << __PRETTY_FUNCTION__ << ": Rejected; a previous gesture has already claimed touch id " << mainTouchId; return true; } AlphabetIconLayout * pAlphaLayout = qobject_cast<AlphabetIconLayout *>(m_qp_iconLayout); if (!pAlphaLayout) { qDebug() << __PRETTY_FUNCTION__ << ": Rejected; There doesn't seem to be a layout on this page (or it isn't an Alpha layout)"; return true; } //if I'm not in reorder mode, then flip to it now; this is just going to change all the graphics in the icons // and enable them to sense taps on special, decorator areas setPageMode(PageMode::Reorder); //note calling this when already in Reorder mode does nothing, so it's ok to just call it and avoid the "if" QPointF positionOfTapICS = mapFromScene(baseGestureEvent->mapToGraphicsScene(tapHoldEvent->hotSpot())); // qDebug() << "tap-n-hold position from the event: " << positionOfTapICS; //TODO: TEMP: the tap coordinate is in PAGE ICS...the layout ICS is a little bit different. It needs to be mapped for total correctness // for now, this will work QPointF positionOfTapLayoutCS = layoutCoordinateFromPageCoordinate(positionOfTapICS); //first, it there is an icon already in motion, silently consume event (yum!) if (m_qp_cached_trackingIcon) { qDebug() << __PRETTY_FUNCTION__ << ": Rejected; Already tracking an icon"; return true; } //tell the layout to start tracking an icon at the position given if (!pAlphaLayout->startTrackingIcon(positionOfTapLayoutCS,m_trackingIconUids)) { qDebug() << __PRETTY_FUNCTION__ << ": Rejected; No icon found at tap-n-hold coordinate " << positionOfTapLayoutCS; return true; } //grab the icon ptr from the icon heap m_qp_cached_trackingIcon = IconHeap::iconHeap()->getIcon(m_trackingIconUids.second,FindIconHint::Copied); if (!m_qp_cached_trackingIcon) { //TODO: TEMP: DEBUG: this doesn't have to end fatally - but until I'm ready for release of the code, i'd like to catch heap-fail problems explicitly //DIE!!! qCritical() << __PRETTY_FUNCTION__ << ": icon heap doesn't have icon uid " << m_trackingIconUids.second; /// <<<--- This should abort the whole process return true; } // QDrag *drag = new QDrag(baseGestureEvent->widget()); // QMimeData *mimeData = new QMimeData; // // mimeData->setText("something"); // drag->setMimeData(mimeData); //// drag->setPixmap(0); // // qDebug() << "exec!"; // Qt::DropAction dropAction = drag->exec(); // qDebug() << "post exec"; m_qp_cached_trackingIcon->slotEnableIconAutoRepaint(); m_qp_cached_trackingIcon->take(this); ///theoretically this could be rejected! //TODO: handling m_qp_cached_trackingIcon->setVisible(true); m_qp_cached_trackingIcon->setPos(positionOfTapICS); m_qp_cached_trackingIcon->update(); return true; }