void PrintLayout::printTable() { struct dive *dive; int done = 0; // percents done int i, row = 0, progress, total = estimateTotalDives(); if (!total) return; // create and setup a table QTableView table; table.setAttribute(Qt::WA_DontShowOnScreen); table.setSelectionMode(QAbstractItemView::NoSelection); table.setFocusPolicy(Qt::NoFocus); table.horizontalHeader()->setVisible(false); table.verticalHeader()->setVisible(false); table.horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed); table.verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); table.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); table.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // fit table to one page initially table.resize(pageW, pageH); // don't show border table.setStyleSheet( "QTableView { border: none }"); // create and fill a table model TablePrintModel model; addTablePrintHeadingRow(&model, row); // add one heading row row++; progress = 0; for_each_dive (i, dive) { if (!dive->selected && printOptions->print_selected) continue; addTablePrintDataRow(&model, row, dive); row++; progress++; emit signalProgress((progress * 10) / total); } done = 10; table.setModel(&model); // set model to table // resize columns to percentages from page width int accW = 0; int cols = model.columns; int tableW = table.width(); for (i = 0; i < model.columns; i++) { int pw = qCeil((qreal)(tablePrintColumnWidths.at(i) * table.width()) / 100.0); accW += pw; if (i == cols - 1 && accW > tableW) /* adjust last column */ pw -= accW - tableW; table.horizontalHeader()->resizeSection(i, pw); } // reset the model at this point model.callReset(); // a list of vertical offsets where pages begin and some helpers QList<unsigned int> pageIndexes; pageIndexes.append(0); /* the algorithm bellow processes the table rows in multiple passes, * compensating for loss of space due to moving rows on a new page instead * of truncating them. * there is a 'passes' array defining how much percents of the total * progress each will take. given, the first and last stage of this function * use 10% each, then the sum of passes[] here should be 80%. * two should be enough! */ const int passes[] = { 70, 10 }; int tableHeight = 0, lastAccIndex = 0, rowH, accH, headings, headingRowHeightD2, headingRowHeight; bool newHeading = false; for (unsigned int pass = 0; pass < sizeof(passes) / sizeof(passes[0]); pass++) { progress = headings = accH = 0; total = model.rows - lastAccIndex; for (i = lastAccIndex; i < model.rows; i++) { rowH = table.rowHeight(i); if (i == 0) { // first row is always a heading. it's height is constant. headingRowHeight = rowH; headingRowHeightD2 = rowH / 2; } if (rowH > pageH - headingRowHeight) // skip huge rows. we don't support row spanning on multiple pages. continue; accH += rowH; if (newHeading) { headings += rowH; newHeading = false; } if (accH > pageH) { lastAccIndex = i; pageIndexes.append(pageIndexes.last() + (accH - rowH)); addTablePrintHeadingRow(&model, i); newHeading = true; accH = 0; i--; } tableHeight += table.rowHeight(i); progress++; emit signalProgress(done + (progress * passes[pass]) / total); } done += passes[pass]; } done = 90; pageIndexes.append(pageIndexes.last() + accH + headings); table.resize(pageW, tableHeight); /* attach a painter and render pages by using pageIndexes * there is a weird QPicture dependency here; we need to offset a page * by headingRowHeightD2, which is half the heading height. the same doesn't * make sense if we are rendering the table widget directly to the printer-painter. */ QPainter painter(printer); painter.setRenderHint(QPainter::Antialiasing); painter.setRenderHint(QPainter::SmoothPixmapTransform); total = pageIndexes.size() - 1; progress = 0; for (i = 0; i < total; i++) { if (i > 0) printer->newPage(); QRegion region(0, pageIndexes.at(i) + headingRowHeightD2 - 1, table.width(), pageIndexes.at(i + 1) - (pageIndexes.at(i) + headingRowHeightD2) + 1); // vectorize the table first by using QPicture QPicture pic; QPainter picPainter; picPainter.begin(&pic); table.render(&picPainter, QPoint(0, 0), region); picPainter.end(); painter.drawPicture(QPoint(0, headingRowHeightD2), pic); progress++; emit signalProgress(done + (progress * 10) / total); } }
void Finder::findFiles() { if(!QDir(m_targetFolder).mkdir("Pliki_PDF")) { emit finished(false, "Folder \"Pliki_PDF\" już istnieje."); return; } bool isFileListLoaded = loadFileList(); if(!isFileListLoaded) return; if(isFileListLoaded && m_fileList.size() == 0) { removeCopiedFiles(); emit finished(false, "Nie znaleziono pasujących pozycji w harmonogramie."); return; } emit signalProgress( 100, "Określenie liczby plików do przeszukania ..."); QDir dir(m_searchedFolder, QString("*.pdf"), QDir::NoSort, QDir::Files | QDir::NoSymLinks); QDirIterator counterIt(dir, QDirIterator::Subdirectories); filesCounter = 0; while (counterIt.hasNext()) { bool abort = m_abort; if (abort) { removeCopiedFiles(); emit finished(false); return; } filesCounter++; counterIt.next(); } if(filesCounter == 0) { emit finished(false, "Nie znaleziono plików PDF w wybranej lokalizacji."); return; } QStringList indexList; QStringList copiedFilesList; QString renamedFile; int count = 0; QDirIterator finalIt(dir, QDirIterator::Subdirectories); while (finalIt.hasNext()) { bool abort = m_abort; if (abort) { removeCopiedFiles(); emit finished(false); return; } if(m_fileList.contains(QFileInfo(finalIt.filePath()).fileName(), Qt::CaseInsensitive)) { indexList = getFileListIdx(QFileInfo(finalIt.filePath()).fileName()); for(int i = 0; i < indexList.size(); ++i) { renamedFile = renameFile(indexList.at(i).toInt(), QFileInfo(finalIt.filePath()).fileName()); if(!QFile(m_targetFolder + "/Pliki_PDF/" + renamedFile).exists()) { QFile::copy(QFileInfo(finalIt.filePath()).filePath(), m_targetFolder + "/Pliki_PDF/" + renamedFile); copiedFilesList.append(renamedFile); emit itemFound(renamedFile, true); } } } finalIt.next(); count++; emit signalProgress( int((double(count)/double(filesCounter)*100)), "Przeszukiwanie plików: " + QString::number(count) + "/" + QString::number(filesCounter)); } QStringList missedFiless = checkMissingFiles(copiedFilesList); QString information = generateCSV(missedFiless,copiedFilesList); emit finished(true,information); }
void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn) { int i, row = 0, col = 0, printed = 0, total = estimateTotalDives(); int animationOriginal = prefs.animation_speed; struct dive *dive; if (!total) return; // disable animations on the profile: prefs.animation_speed = 0; // setup a painter QPainter painter; painter.begin(printer); painter.setRenderHint(QPainter::Antialiasing); painter.setRenderHint(QPainter::SmoothPixmapTransform); // setup the profile widget QPointer<ProfileWidget2> profile = MainWindow::instance()->graphics(); const int profileFrameStyle = profile->frameStyle(); profile->setFrameStyle(QFrame::NoFrame); profile->setPrintMode(true, !printOptions->color_selected); profile->setFontPrintScale(divesPerRow * divesPerColumn > 3 ? 0.6 : 1.0); QSize originalSize = profile->size(); // swap rows/col for landscape if (printer->orientation() == QPrinter::Landscape) { int swap = divesPerColumn; divesPerColumn = divesPerRow; divesPerRow = swap; } // padding in pixels between two dives. no padding if only one dive per page. const int padDef = 20; const int padW = (divesPerColumn < 2) ? 0 : padDef; const int padH = (divesPerRow < 2) ? 0 : padDef; // estimate dimensions for a single dive const int scaledW = ESTIMATE_DIVE_DIM(pageW, divesPerColumn, padW); const int scaledH = ESTIMATE_DIVE_DIM(pageH, divesPerRow, padH); // padding in pixels between profile and table const int padPT = 5; // create a model and table ProfilePrintModel model; model.setFontsize(7); // if this is changed we also need to change 'const int sr' in the constructor // if there is only one dive per page row we pass fitNotesToHeight to be almost half the page height QPointer<QTableView> table(createProfileTable(&model, scaledW, (divesPerRow == 1) ? scaledH * 0.45 : 0.0)); // profilePrintTableMaxH updates after the table is created const int tableH = profilePrintTableMaxH; // resize the profile widget profile->resize(scaledW, scaledH - tableH - padPT); // offset table or profile on top int yOffsetProfile = 0, yOffsetTable = 0; if (printOptions->notes_up) yOffsetProfile = tableH + padPT; else yOffsetTable = scaledH - tableH; // plot the dives at specific rows and columns on the page for_each_dive (i, dive) { if (!dive->selected && printOptions->print_selected) continue; if (col == divesPerColumn) { col = 0; row++; if (row == divesPerRow) { row = 0; printer->newPage(); } } // draw a profile QTransform origTransform = painter.transform(); painter.translate((scaledW + padW) * col, (scaledH + padH) * row + yOffsetProfile); profile->plotDive(dive, true); // make sure the profile is actually redrawn #ifdef Q_OS_LINUX // on Linux there is a vector line bug (big lines in PDF), which forces us to render to QImage QImage image(scaledW, scaledH - tableH - padPT, QImage::Format_ARGB32); QPainter imgPainter(&image); imgPainter.setRenderHint(QPainter::Antialiasing); imgPainter.setRenderHint(QPainter::SmoothPixmapTransform); profile->render(&imgPainter, QRect(0, 0, scaledW, scaledH - tableH - padPT)); imgPainter.end(); painter.drawImage(image.rect(),image); #else // for other OS we can try rendering the profile as vector profile->render(&painter, QRect(0, 0, scaledW, scaledH - tableH - padPT)); #endif painter.setTransform(origTransform); // draw a table QPicture pic; QPainter picPainter; painter.translate((scaledW + padW) * col, (scaledH + padH) * row + yOffsetTable); model.setDive(dive); picPainter.begin(&pic); table->render(&picPainter); picPainter.end(); painter.drawPicture(QPoint(0,0), pic); painter.setTransform(origTransform); col++; printed++; emit signalProgress((printed * 100) / total); } // cleanup painter.end(); profile->setFrameStyle(profileFrameStyle); profile->setPrintMode(false); profile->resize(originalSize); // we need to force a redraw of the profile so it switches back from print mode profile->plotDive(0, true); // re-enable animations prefs.animation_speed = animationOriginal; }
bool Finder::loadFileList() { emit signalProgress(100, "Wczytywanie harmonogramu ..."); QXlsx::Document schedule(m_schedulePath); if(!checkSchedule(schedule)) { removeCopiedFiles(); emit finished(false, "Harmonogram niepoprawnie sformatowany."); return false; } // find last row of schedule int lastRow = 0; if(!rowCount(schedule,lastRow)) return false; if( m_searchCriterion == "Others") { if(!m_copartnerSet.isEmpty()) emit showCopartnerDialog(); else { removeCopiedFiles(); emit finished(false, "Nie znaleziono kooperantów w harmonogramie."); return false; } if(m_searchCriterion == "Others") { removeCopiedFiles(); emit finished(false, "Anulowano wyszukiwanie."); return false; } } QMap<QString,QColor> colorsMap; QColor color; colorsMap["nocolor"] = color; color.setRgbF(1,0.8,0,1); colorsMap["orange"] = color; color.setRgbF(1,0.752941,0,1); colorsMap["orange2"] = color; color.setRgbF(1,0.8,0.6,1); colorsMap["orange3"] = color; color.setRgbF(1,1,0,1); colorsMap["yellow"] = color; color.setRgbF(1,1,0.4,1); colorsMap["yellow2"] = color; if(m_isWhite) { for (int row=7; row<=lastRow; ++row) { bool abort = m_abort; if (abort) { emit finished(false); return false; } if (QXlsx::Cell *cell=schedule.cellAt(row, 3)) findCells(schedule,cell,row,colorsMap); emit signalProgress(int((double(row)/double(lastRow)*100))+1, "Tworzenie listy plików ..."); } } else { for (int row=7; row<=lastRow; ++row) { bool abort = m_abort; if (abort) { emit finished(false); return false; } QXlsx::Cell *cell=schedule.cellAt(row, 3); if (schedule.cellAt(row, 2)->format().patternBackgroundColor().toRgb() != colorsMap["nocolor"]) findCells(schedule,cell,row,colorsMap); emit signalProgress(int((double(row)/double(lastRow)*100))+1, "Tworzenie listy plików ..."); } } qDebug() << "Wielkość listy: " << m_fileList.size(); return true; }
void SaveImgThread::run() { emit signalProgress(d->newUrl, 10); bool sixteenBit = (d->frmt == KSaneWidget::FormatRGB_16_C); DImg img((uint)d->width, (uint)d->height, sixteenBit, false); int progress; if (!sixteenBit) { uchar* src = (uchar*)d->ksaneData.data(); uchar* dst = img.bits(); for (int w = 0; w < d->width; ++w) { dst[0] = src[2]; // Blue dst[1] = src[1]; // Green dst[2] = src[0]; // Red dst[3] = 0x00; // Alpha dst += 4; src += 3; progress = 10 + (int)(((double)w * 50.0) / d->width); if (progress % 5 == 0) { emit signalProgress(d->newUrl, progress); } } } else { unsigned short* src = (unsigned short*)d->ksaneData.data(); unsigned short* dst = (unsigned short*)img.bits(); for (int w = 0; w < d->width; ++w) { dst[0] = src[2]; // Blue dst[1] = src[1]; // Green dst[2] = src[0]; // Red dst[3] = 0x0000; // Alpha dst += 4; src += 3; progress = 10 + (int)(((double)w * 50.0) / d->width); if (progress % 5 == 0) { emit signalProgress(d->newUrl, progress); } } } emit signalProgress(d->newUrl, 60); bool success = img.save(d->newUrl.toLocalFile(), d->format); emit signalProgress(d->newUrl, 80); if (!success) { emit signalComplete(d->newUrl, success); return; } DMetadata meta(d->newUrl.toLocalFile()); meta.setExifTagString("Exif.Image.DocumentName", QLatin1String("Scanned Image")); // not i18n meta.setExifTagString("Exif.Image.Make", d->make); meta.setXmpTagString("Xmp.tiff.Make", d->make); meta.setExifTagString("Exif.Image.Model", d->model); meta.setXmpTagString("Xmp.tiff.Model", d->model); meta.setImageOrientation(DMetadata::ORIENTATION_NORMAL); meta.setImageColorWorkSpace(DMetadata::WORKSPACE_SRGB); emit signalProgress(d->newUrl, 90); meta.applyChanges(); emit signalProgress(d->newUrl, 100); emit signalComplete(d->newUrl, success); }
void CalPainter::paint(int month) { if (!device()) { return; } int width = device()->width(); int height = device()->height(); CalSettings* settings = CalSettings::instance(); CalParams& params = CalSettings::instance()->params; // -------------------------------------------------- // FIXME: magic number 42 int days[42]; int startDayOffset = KGlobal::locale()->weekStartDay(); for (int i = 0; i < 42; ++i) { days[i] = -1; } QDate d; KGlobal::locale()->calendar()->setDate(d, params.year, month, 1); int s = d.dayOfWeek(); if (s + 7 - startDayOffset >= 7) { s = s - 7; } for (int i = s; i < (s + KGlobal::locale()->calendar()->daysInMonth(d)); ++i) { days[i + (7 - startDayOffset)] = i - s + 1; } // ----------------------------------------------- QRect rCal(0, 0, 0, 0); QRect rImage(0, 0, 0, 0); QRect rCalHeader(0, 0, 0, 0); int cellSizeX; int cellSizeY; switch (params.imgPos) { case (CalParams::Top): { rImage.setWidth(width); rImage.setHeight((int)(height * params.ratio / (params.ratio + 100))); int remainingHeight = height - rImage.height(); cellSizeX = (width - 20) / 7; cellSizeY = remainingHeight / 8; rCal.setWidth(cellSizeX * 7); rCal.setHeight(cellSizeY * 7); rCalHeader.setWidth(rCal.width()); rCalHeader.setHeight(cellSizeY); rCalHeader.moveTop(rImage.bottom()); rCalHeader.moveLeft(width / 2 - rCalHeader.width() / 2); rCal.moveTopLeft(rCalHeader.bottomLeft()); break; } case (CalParams::Left): { rImage.setHeight(height); rImage.setWidth((int)(width * params.ratio / (params.ratio + 100))); int remainingWidth = width - rImage.width(); cellSizeX = (remainingWidth - 20) / 8; cellSizeY = height / 8; rCal.setWidth(cellSizeX * 7); rCal.setHeight(cellSizeY * 7); rCalHeader.setWidth(rCal.width()); rCalHeader.setHeight(cellSizeY); rCalHeader.moveLeft(rImage.right() + cellSizeX); rCal.moveTopLeft(rCalHeader.bottomLeft()); break; } case (CalParams::Right): { rImage.setHeight(height); rImage.setWidth((int)(width * params.ratio / (params.ratio + 100))); int remainingWidth = width - rImage.width(); cellSizeX = (remainingWidth - 20) / 8; cellSizeY = height / 8; rCal.setWidth(cellSizeX * 7); rCal.setHeight(cellSizeY * 7); rCalHeader.setWidth(rCal.width()); rCalHeader.setHeight(cellSizeY); rCal.moveTop(rCalHeader.bottom()); rImage.moveLeft(width - rImage.width()); break; } default: return; } int fontPixels = cellSizeX / 3; params.baseFont.setPixelSize(fontPixels); // --------------------------------------------------------------- fillRect(0, 0, width, height, Qt::white); setFont(params.baseFont); // --------------------------------------------------------------- save(); QFont f(params.baseFont); f.setBold(true); f.setPixelSize(f.pixelSize() + 5); setFont(f); drawText(rCalHeader, Qt::AlignLeft | Qt::AlignVCenter, QString::number(params.year)); drawText(rCalHeader, Qt::AlignRight | Qt::AlignVCenter, KGlobal::locale()->calendar()->monthName(month, params.year)); restore(); // --------------------------------------------------------------- int sx, sy; QRect r, rsmall, rSpecial; r.setWidth(cellSizeX); r.setHeight(cellSizeY); int index = 0; save(); setPen(Qt::red); sy = rCal.top(); for (int i = 0; i < 7; ++i) { int dayname = i + startDayOffset; if (dayname > 7) { dayname = dayname - 7; } sx = cellSizeX * i + rCal.left(); r.moveTopLeft(QPoint(sx, sy)); rsmall = r; rsmall.setWidth(r.width() - 2); rsmall.setHeight(r.height() - 2); drawText(rsmall, Qt::AlignRight | Qt::AlignBottom, KGlobal::locale()->calendar()->weekDayName(dayname, KCalendarSystem::ShortDayName)); } restore(); for (int j = 0; j < 6; ++j) { sy = cellSizeY * (j + 1) + rCal.top(); for (int i = 0; i < 7; ++i) { sx = cellSizeX * i + rCal.left(); r.moveTopLeft(QPoint(sx, sy)); rsmall = r; rsmall.setWidth(r.width() - 2); rsmall.setHeight(r.height() - 2); if (days[index] != -1) { if (settings->isSpecial(month, days[index])) { save(); setPen(settings->getDayColor(month, days[index])); drawText(rsmall, Qt::AlignRight | Qt::AlignBottom, QString::number(days[index])); QString descr = settings->getDayDescr(month, days[index]); kDebug() << "Painting special info: '" << descr << "' for date " << days[index] << "/" << month; rSpecial = rsmall; rSpecial.translate(2, 0); QFont f(params.baseFont); f.setPixelSize(f.pixelSize() / 3); setFont(f); drawText(rSpecial, Qt::AlignLeft | Qt::AlignTop, descr); restore(); } else { drawText(rsmall, Qt::AlignRight | Qt::AlignBottom, QString::number(days[index])); } } index++; } } // --------------------------------------------------------------- if (params.drawLines) { sx = rCal.left(); for (int j = 0; j < 8; ++j) { sy = cellSizeY * j + rCal.top(); drawLine(sx, sy, rCal.right(), sy); } sy = rCal.top(); for (int i = 0; i < 8; ++i) { sx = cellSizeX * i + rCal.left(); drawLine(sx, sy, sx, rCal.bottom()); } } // Check if RAW file. QFileInfo fi(imagePath_.path()); QString rawFilesExt(KDcrawIface::KDcraw::rawFiles()); if (rawFilesExt.toUpper().contains(fi.suffix().toUpper())) { KDcrawIface::KDcraw::loadDcrawPreview(image_, imagePath_.path()); } else { image_.load(imagePath_.path()); } if (image_.isNull()) { fillRect(rImage, Qt::blue); } else { if ( orientation_ != KPMetadata::ORIENTATION_UNSPECIFIED ) { QMatrix matrix = RotationMatrix::toMatrix(orientation_); image_ = image_.transformed( matrix ); } emit signalProgress(0); image_ = image_.scaled(rImage.width(), rImage.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); emit signalTotal(image_.height()); int h = image_.height(); int x = rImage.bottomLeft().x() + (rImage.width() - image_.width()) / 2; int y = (rImage.height() - h) / 2; int blockSize = 10; int block = 0; while (block < h && !cancelled_) { if (block + blockSize > h) { blockSize = h - block; } drawImage(x, y + block, image_, 0, block, image_.width(), blockSize); block += blockSize; emit signalProgress(block); } emit signalFinished(); } }
void MyMoneyStorageXML::writeFile(QIODevice* qf, IMyMoneySerialize* storage) { Q_CHECK_PTR(qf); Q_CHECK_PTR(storage); if (!storage) { return; } m_storage = storage; // qDebug("XMLWRITER: Starting file write"); m_doc = new QDomDocument("KMYMONEY-FILE"); Q_CHECK_PTR(m_doc); QDomProcessingInstruction instruct = m_doc->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"utf-8\""); m_doc->appendChild(instruct); QDomElement mainElement = m_doc->createElement("KMYMONEY-FILE"); m_doc->appendChild(mainElement); QDomElement fileInfo = m_doc->createElement("FILEINFO"); writeFileInformation(fileInfo); mainElement.appendChild(fileInfo); QDomElement userInfo = m_doc->createElement("USER"); writeUserInformation(userInfo); mainElement.appendChild(userInfo); QDomElement institutions = m_doc->createElement("INSTITUTIONS"); writeInstitutions(institutions); mainElement.appendChild(institutions); QDomElement payees = m_doc->createElement("PAYEES"); writePayees(payees); mainElement.appendChild(payees); QDomElement tags = m_doc->createElement("TAGS"); writeTags(tags); mainElement.appendChild(tags); QDomElement accounts = m_doc->createElement("ACCOUNTS"); writeAccounts(accounts); mainElement.appendChild(accounts); QDomElement transactions = m_doc->createElement("TRANSACTIONS"); writeTransactions(transactions); mainElement.appendChild(transactions); QDomElement keyvalpairs = writeKeyValuePairs(m_storage->pairs()); mainElement.appendChild(keyvalpairs); QDomElement schedules = m_doc->createElement("SCHEDULES"); writeSchedules(schedules); mainElement.appendChild(schedules); QDomElement equities = m_doc->createElement("SECURITIES"); writeSecurities(equities); mainElement.appendChild(equities); QDomElement currencies = m_doc->createElement("CURRENCIES"); writeCurrencies(currencies); mainElement.appendChild(currencies); QDomElement prices = m_doc->createElement("PRICES"); writePrices(prices); mainElement.appendChild(prices); QDomElement reports = m_doc->createElement("REPORTS"); writeReports(reports); mainElement.appendChild(reports); QDomElement budgets = m_doc->createElement("BUDGETS"); writeBudgets(budgets); mainElement.appendChild(budgets); QDomElement onlineJobs = m_doc->createElement("ONLINEJOBS"); writeOnlineJobs(onlineJobs); mainElement.appendChild(onlineJobs); QTextStream stream(qf); stream.setCodec("UTF-8"); stream << m_doc->toString(); delete m_doc; m_doc = 0; //hides the progress bar. signalProgress(-1, -1); // this seems to be nonsense, but it clears the dirty flag // as a side-effect. m_storage->setLastModificationDate(m_storage->lastModificationDate()); m_storage = 0; }
void ProjectSquareWell::XMLSaveSystem(QDomElement &project) { QDomDocument doc = project.ownerDocument(); QDomElement system = doc.createElement("system"); project.appendChild(system); QDomElement elem = doc.createElement("points"); elem.setAttribute("value",m_system->points()); system.appendChild(elem); elem = doc.createElement("lowervalue"); elem.setAttribute("value",m_system->lowerValue()); system.appendChild(elem); elem = doc.createElement("highervalue"); elem.setAttribute("value",m_system->higherValue()); system.appendChild(elem); elem = doc.createElement("particlemass"); elem.setAttribute("value",m_system->particleMass()); system.appendChild(elem); // save the potential SquareWellPotential *p = (SquareWellPotential*) m_system->potential(); QDomElement squarewellpotential = doc.createElement("squarewellpotential"); system.appendChild(squarewellpotential); elem = doc.createElement("lowedge"); elem.setAttribute("value", p->lowEdge()); squarewellpotential.appendChild(elem); elem = doc.createElement("highedge"); elem.setAttribute("value", p->highEdge()); squarewellpotential.appendChild(elem); elem = doc.createElement("highpotential"); elem.setAttribute("value", p->highPot()); squarewellpotential.appendChild(elem); elem = doc.createElement("lowpotential"); elem.setAttribute("value", p->lowPot()); squarewellpotential.appendChild(elem); QDomElement curve = doc.createElement("curve"); squarewellpotential.appendChild(curve); register unsigned int i; for (i = 0; i < p->points(); i++) { elem = doc.createElement("point"); elem.setAttribute("value", p->y(i)); curve.appendChild(elem); } emit signalProgress(40); // save the eigenvalues Eigenvalue *e; QDomElement eigen; for (i = 0; i < m_system->eigenNumber(); i++) { e = m_system->eigenvalue(i); eigen = doc.createElement("eigenfunction"); system.appendChild(eigen); elem = doc.createElement("eigenvalue"); elem.setAttribute("value",e->eigenvalue()); eigen.appendChild(elem); elem = doc.createElement("meanpotential"); elem.setAttribute("value",e->meanPotential()); eigen.appendChild(elem); elem = doc.createElement("meankinetic"); elem.setAttribute("value",e->meanKinetic()); eigen.appendChild(elem); elem = doc.createElement("meanposition"); elem.setAttribute("value",e->meanPosition()); eigen.appendChild(elem); curve = doc.createElement("curve"); eigen.appendChild(curve); register unsigned int i; for (i = 0; i < e->points(); i++) { elem = doc.createElement("point"); elem.setAttribute("value", e->y(i)); curve.appendChild(elem); } } }