Examples of QByteArray


Examples of com.trolltech.qt.core.QByteArray

      if (reader.isStartElement()) {
        if (reader.name().equalsIgnoreCase("Size"))
          data.setSize(intValue());
        if (reader.name().equalsIgnoreCase("Body")) {
          byte[] b = textValue().getBytes();   // data binary
          QByteArray hexData = new QByteArray(b);
          QByteArray binData = new QByteArray(QByteArray.fromHex(hexData));
          data.setBody(binData.toByteArray());
        }
        if (reader.name().equalsIgnoreCase("BodyHash")) {
          byte[] b = textValue().getBytes();   // data binary
          QByteArray hexData = new QByteArray(b);
          QByteArray binData = new QByteArray(QByteArray.fromHex(hexData));
          data.setBodyHash(binData.toByteArray());
        }

        reader.readNext();
        if (reader.name().equalsIgnoreCase("data") && reader.isEndElement())
          atEnd = true;
View Full Code Here

Examples of com.trolltech.qt.core.QByteArray

            else
              notebook.getPublishing().setAscending(false);
          }   
          if (reader.name().equalsIgnoreCase("Icon")) {
            byte[] b = textValue().getBytes();   // data binary
            QByteArray hexData = new QByteArray(b);
            QByteArray binData = new QByteArray(QByteArray.fromHex(hexData));
            notebookIcon = new QIcon(QPixmap.fromImage(QImage.fromData(binData)));
          }
          if (reader.name().equalsIgnoreCase("Stack"))
            notebook.setStack(textValue());
        }
View Full Code Here

Examples of com.trolltech.qt.core.QByteArray

          return;
        }
        buffer.close();
         
    logger.log(logger.EXTREME, "Updating database");
    QByteArray b = new QBuffer(buffer).buffer();
    conn.getNoteTable().setThumbnail(guid, b);
    conn.getNoteTable().setThumbnailNeeded(guid, false);
    mutex.unlock();
  }
View Full Code Here

Examples of com.trolltech.qt.core.QByteArray

  public synchronized int getWorkQueueSize() {
    return workQueue.size();
  }
 
  private void generateThumbnail() {
    QByteArray js = new QByteArray();
    logger.log(logger.HIGH, "Starting thumbnail for " +guid);
    ArrayList<QTemporaryFile> tempFiles = new ArrayList<QTemporaryFile>();
    Note currentNote = conn.getNoteTable().getNote(guid,true,true,false,true,false);
    NoteFormatter formatter = new NoteFormatter(logger, conn, tempFiles);
    currentNote = conn.getNoteTable().getNote(guid, true, true, false, true, false);
    formatter.setNote(currentNote, true);
    formatter.setHighlight(null);
    js.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");   
    js.append("<style type=\"text/css\">.en-crypt-temp { border-collapse:collapse; border-style:solid; border-color:blue; padding:0.0mm 0.0mm 0.0mm 0.0mm; }</style>");
    js.append("<style type=\"text/css\">en-hilight { background-color: rgb(255,255,0) }</style>");
    js.append("<style> img { max-width:100%; }</style>");
    js.append("<style type=\"text/css\">en-spell { text-decoration: none; border-bottom: dotted 1px #cc0000; }</style>");
    js.append("</head>");
    js.append(formatter.rebuildNoteHTML());
    js.append("</HTML>");
    js.replace("<!DOCTYPE en-note SYSTEM 'http://xml.evernote.com/pub/enml.dtd'>", "");
    js.replace("<!DOCTYPE en-note SYSTEM 'http://xml.evernote.com/pub/enml2.dtd'>", "");
    js.replace("<?xml version='1.0' encoding='UTF-8'?>", "");
    int zoom = 1;
    if (currentNote != null && currentNote.getContent() != null) {
      String content = currentNote.getContent();
      zoom = Global.calculateThumbnailZoom(content);
    }
View Full Code Here

Examples of com.trolltech.qt.core.QByteArray

  }
 
 
  @Override
  public void dragEnterEvent(QDragEnterEvent event) {
    event.mimeData().setData("application/x-nevernote-trash", new QByteArray(currentItem().text(1)));
    event.accept();
  }
View Full Code Here

Examples of com.trolltech.qt.core.QByteArray

    if (!file.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.ReadOnly))) {
      // If we can't get to the file, it is probably locked.  We'll try again later.
      logger.log(logger.LOW, "Unable to save externally edited file - locked.  Saving for later.");
      return false;
    }
    QByteArray binData = file.readAll();
    file.close();
    if (binData.size() == 0) {
      // If we can't get to the file, it is probably locked.  We'll try again later.
      logger.log(logger.LOW, "Unable to save externally edited file - zero size.  Saving for later.");
      return false;
    }
 
    String fileData =binData.toString();
   
    // Fix \r\n & \n and turn inte HTML
    QWebPage page = new QWebPage();
    page.mainFrame().setContent(binData);
    fileData = page.mainFrame().toHtml();
View Full Code Here

Examples of com.trolltech.qt.core.QByteArray

    if (!file.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.ReadOnly))) {
      // If we can't get to the file, it is probably locked.  We'll try again later.
      logger.log(logger.LOW, "Unable to save externally edited file - locked.  Saving for later.");
      return false;
    }
    QByteArray binData = file.readAll();
    file.close();
    if (binData.size() == 0) {
      // If we can't get to the file, it is probably locked.  We'll try again later.
      logger.log(logger.LOW, "Unable to save externally edited file - zero size.  Saving for later.");
      return false;
    }
     
View Full Code Here

Examples of com.trolltech.qt.core.QByteArray

    if (!query.exec())
      logger.log(logger.EXTREME, "Error finding saved search icon.");
    if (!query.next() || query.getBlob(0) == null)
      return null;
   
    QByteArray blob = new QByteArray(query.getBlob(0));
    QIcon icon = new QIcon(QPixmap.fromImage(QImage.fromData(blob)));
    return icon;
  }
View Full Code Here

Examples of com.trolltech.qt.core.QByteArray

          }
          QPixmap p = icon.pixmap(32, 32);
          QImage i = p.toImage();
           i.save(buffer, type.toUpperCase());
           buffer.close();
           QByteArray b = new QByteArray(buffer.buffer());
           if (!b.isNull() && !b.isEmpty())
             query.bindValue(":icon", b.toByteArray());
           else
             return;
    }
    query.bindValue(":guid", guid);
    if (!query.exec())
View Full Code Here

Examples of com.trolltech.qt.core.QByteArray

    if (!query.exec("SELECT guid, icon from SavedSearch"))
      logger.log(logger.EXTREME, "Error executing SavedSearch getAllIcons select.");
    while (query.next()) {
      if (query.getBlob(1) != null) {
        String guid = query.valueString(0);
        QByteArray blob = new QByteArray(query.getBlob(1));
        QIcon icon = new QIcon(QPixmap.fromImage(QImage.fromData(blob)));
        values.put(guid, icon);
      }
    }
    return values;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.