diff options
author | Javier <dev.git@javispedro.com> | 2015-06-14 05:18:53 +0200 |
---|---|---|
committer | Javier <dev.git@javispedro.com> | 2015-06-14 05:18:53 +0200 |
commit | 2910de560ead3ff65db26292fc27e427a5cf9b5e (patch) | |
tree | 12f6c29b77244528176abeee0934bdc4c560f08d | |
parent | 46cb4b079be113996214660020d6ef0c3d1f1e80 (diff) | |
download | scribiu-2910de560ead3ff65db26292fc27e427a5cf9b5e.tar.gz scribiu-2910de560ead3ff65db26292fc27e427a5cf9b5e.zip |
add export feature and desktop file
-rw-r--r-- | mainwindow.cc | 135 | ||||
-rw-r--r-- | mainwindow.h | 10 | ||||
-rw-r--r-- | mainwindow.ui | 63 | ||||
-rw-r--r-- | notebookview.cc | 28 | ||||
-rw-r--r-- | notebookview.h | 6 | ||||
-rw-r--r-- | paperreplay.cc | 6 | ||||
-rw-r--r-- | scribiu.desktop | 11 | ||||
-rw-r--r-- | scribiu.pro | 16 | ||||
-rw-r--r-- | scribiu.svg | 553 | ||||
-rw-r--r-- | smartpensyncer.cc | 3 |
10 files changed, 826 insertions, 5 deletions
diff --git a/mainwindow.cc b/mainwindow.cc index dd687a2..0fdf38d 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -1,4 +1,7 @@ #include <QtCore/QDebug> +#include <QtGui/QFileDialog> +#include <QtGui/QMessageBox> +#include <QtSvg/QSvgGenerator> #include "mainwindow.h" #include "ui_mainwindow.h" @@ -24,10 +27,15 @@ MainWindow::MainWindow(QWidget *parent) : ui->paperReplayView->horizontalHeader()->setResizeMode(1, QHeaderView::Fixed); ui->paperReplayView->setVisible(false); Phonon::createPath(_media, _mediaOutput); + _media->setTickInterval(500); ui->replaySlider->setMediaObject(_media); ui->pauseButton->setVisible(false); connect(_media, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(handleMediaStateChange(Phonon::State))); + connect(_media, SIGNAL(totalTimeChanged(qint64)), + this, SLOT(handleMediaTotalTimeChanged(qint64))); + connect(_media, SIGNAL(tick(qint64)), + this, SLOT(handleMediaTick(qint64))); } MainWindow::~MainWindow() @@ -73,6 +81,46 @@ void MainWindow::openNotebook(const QString &pen, const QString ¬ebook) } } +void MainWindow::exportCurrentPageAsPng(const QString &file) +{ + qDebug() << "Exporting current page" << ui->notebookView->curPage() << "to" << file; + QImage image = ui->notebookView->exportPage(ui->notebookView->curPage()); + if (!image.save(file, "PNG")) { + QMessageBox::warning(this, tr("Export page"), + tr("Could not export current page to '%s'").arg(file)); + } +} + +void MainWindow::exportCurrentPageAsSvg(const QString &file) +{ + QSvgGenerator svg; + svg.setFileName(file); + svg.setSize(ui->notebookView->getCurPageSize()); + svg.setViewBox(ui->notebookView->getCurPageTrim()); + svg.setTitle(_curNotebookName + " p." + QString::number(ui->notebookView->curPage())); + svg.setDescription("Page " + QString::number(ui->notebookView->curPage()) + " of " + _curNotebookName + " from " + _curPenName); + qDebug() << "Exporting current page" << ui->notebookView->curPage() << "to" << file; + QPainter painter; + painter.begin(&svg); + ui->notebookView->renderPage(&painter, ui->notebookView->curPage()); + painter.end(); +} + +void MainWindow::exportCurrentPaperReplayAsAac(const QString &file) +{ + QString src = _media->currentSource().fileName(); + if (src.isEmpty()) { + QMessageBox::warning(this, tr("Export audio"), + tr("No audio file is selected")); + return; + } + qDebug() << "Exporting current audio" << src << "to" << file; + if (!QFile::copy(src, file)) { + QMessageBox::warning(this, tr("Export audio"), + tr("Could not export current audio to '%s'").arg(file)); + } +} + void MainWindow::handleNotebookSelected(const QModelIndex &index) { if (!index.isValid()) { @@ -151,13 +199,100 @@ void MainWindow::handleMediaStateChange(Phonon::State state) _media->seek(_pendingSeek); _pendingSeek = 0; } + ui->mediaPosLabel->setText(formatDuration(_media->currentTime())); + ui->mediaLenLabel->setText("/ " + formatDuration(_media->totalTime())); break; case Phonon::PausedState: ui->playButton->setVisible(true); ui->pauseButton->setVisible(false); + ui->mediaPosLabel->setText(formatDuration(_media->currentTime())); + ui->mediaLenLabel->setText("/ " + formatDuration(_media->totalTime())); break; default: ui->playButton->setVisible(true); ui->pauseButton->setVisible(false); + ui->mediaPosLabel->setText(QString()); + ui->mediaLenLabel->setText(QString()); + break; + } +} + +void MainWindow::handleMediaTotalTimeChanged(qint64 time) +{ + ui->mediaLenLabel->setText("/ " + formatDuration(time)); +} + +void MainWindow::handleMediaTick(qint64 time) +{ + ui->mediaPosLabel->setText(formatDuration(time)); +} + +void MainWindow::handleExport() +{ + if (_curNotebookName == PAPER_REPLAY) { + QStringList filters; + filters << tr("Current audio as AAC (*.aac)"); + QString filter; + QString fileName = QFileDialog::getSaveFileName(this, tr("Export page"), QString(), + filters.join(";;"), &filter); + if (fileName.isEmpty()) return; + int filterIndex = filters.indexOf(filter); + switch (filterIndex) { + case 0: + if (!fileName.endsWith(".aac", Qt::CaseInsensitive)) { + fileName.append(".aac"); + } + exportCurrentPaperReplayAsAac(fileName); + break; + } + } else if (!_curNotebookName.isEmpty()) { + QStringList filters; + filters << tr("Current page as PNG image (*.png)") + << tr("Current page as SVG image (*.svg)") + << tr("Current audio as AAC (*.aac)"); + QString filter; + QString fileName = QFileDialog::getSaveFileName(this, tr("Export page"), QString(), + filters.join(";;"), &filter); + if (fileName.isEmpty()) return; + int filterIndex = filters.indexOf(filter); + switch (filterIndex) { + case 0: + if (!fileName.endsWith(".png", Qt::CaseInsensitive)) { + fileName.append(".png"); + } + exportCurrentPageAsPng(fileName); + break; + case 1: + if (!fileName.endsWith(".svg", Qt::CaseInsensitive)) { + fileName.append(".svg"); + } + exportCurrentPageAsSvg(fileName); + break; + case 2: + if (!fileName.endsWith(".aac", Qt::CaseInsensitive)) { + fileName.append(".aac"); + } + exportCurrentPaperReplayAsAac(fileName); + break; + } + } else { + QMessageBox::warning(this, tr("Export page"), + tr("Open a notebook or audio in order to export")); + } +} + +QString MainWindow::formatDuration(qint64 time) +{ + int secs = time / 1000; + int mins = secs / 60; + secs %= 60; + int hours = mins / 60; + mins %= 60; + + const QChar fill('0'); + if (hours) { + return QString("%1:%2:%3").arg(hours).arg(mins, 2, 10, fill).arg(secs, 2, 10, fill); + } else { + return QString("%2:%3").arg(mins).arg(secs, 2, 10, fill); } } diff --git a/mainwindow.h b/mainwindow.h index cafec49..9bce36a 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -24,6 +24,10 @@ public slots: void closeNotebook(); void openNotebook(const QString &pen, const QString ¬ebook); + void exportCurrentPageAsPng(const QString &file); + void exportCurrentPageAsSvg(const QString &file); + void exportCurrentPaperReplayAsAac(const QString &file); + private slots: void handleNotebookSelected(const QModelIndex &index); void handleCurPageChanged(); @@ -32,6 +36,12 @@ private slots: void handlePaperReplayPlay(); void handlePaperReplayPause(); void handleMediaStateChange(Phonon::State state); + void handleMediaTotalTimeChanged(qint64 time); + void handleMediaTick(qint64 time); + void handleExport(); + +private: + QString formatDuration(qint64 time); private: Ui::MainWindow *ui; diff --git a/mainwindow.ui b/mainwindow.ui index 1662e7f..56ad8ad 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -118,6 +118,40 @@ </widget> </item> <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>10</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QToolButton" name="exportButton"> + <property name="maximumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="text"> + <string>...</string> + </property> + <property name="icon"> + <iconset theme="document-save-as"> + <normaloff/> + </iconset> + </property> + </widget> + </item> + <item> <spacer name="viewpaneToolsSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -233,6 +267,9 @@ </item> <item> <layout class="QHBoxLayout" name="paperReplayTools"> + <property name="rightMargin"> + <number>4</number> + </property> <item> <widget class="QToolButton" name="playButton"> <property name="maximumSize"> @@ -273,7 +310,14 @@ <widget class="Phonon::SeekSlider" name="replaySlider" native="true"/> </item> <item> - <widget class="QLabel" name="replayLabel"/> + <widget class="QLabel" name="mediaPosLabel"/> + </item> + <item> + <widget class="QLabel" name="mediaLenLabel"> + <property name="text"> + <string/> + </property> + </widget> </item> </layout> </item> @@ -517,6 +561,22 @@ </hint> </hints> </connection> + <connection> + <sender>exportButton</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>handleExport()</slot> + <hints> + <hint type="sourcelabel"> + <x>402</x> + <y>42</y> + </hint> + <hint type="destinationlabel"> + <x>358</x> + <y>192</y> + </hint> + </hints> + </connection> </connections> <slots> <slot>handleNotebookSelected(QModelIndex)</slot> @@ -526,5 +586,6 @@ <slot>handlePaperReplayPlay()</slot> <slot>handlePaperReplayPause()</slot> <slot>handlePaperReplaySelected(QModelIndex)</slot> + <slot>handleExport()</slot> </slots> </ui> diff --git a/notebookview.cc b/notebookview.cc index 2bca4f7..f433664 100644 --- a/notebookview.cc +++ b/notebookview.cc @@ -88,6 +88,34 @@ void NotebookView::setZoom(int zoom) } } +QSize NotebookView::getCurPageSize() const +{ + return _nb->getPageSize(_curPage); +} + +QRect NotebookView::getCurPageTrim() const +{ + return _nb->getPageTrim(_curPage); +} + +QImage NotebookView::exportPage(int pageNum) const +{ + const QRect pageTrim = getCurPageTrim(); + QImage image(pageTrim.width() / 4, pageTrim.height() / 4, QImage::Format_RGB32); + QPainter painter(&image); + painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); + renderPage(&painter, pageNum, QRectF(), pageTrim); + return image; +} + +void NotebookView::renderPage(QPainter *painter, int pageNum, const QRectF &target, const QRectF &source) const +{ + QGraphicsScene scene; + PageItem *item = new PageItem(_nb, 0, pageNum); + scene.addItem(item); + scene.render(painter, target, source, Qt::KeepAspectRatio); +} + void NotebookView::requestPaperReplay(const QString &file, qint64 time) { emit paperReplayRequested(file, time); diff --git a/notebookview.h b/notebookview.h index 1b3eb46..7039506 100644 --- a/notebookview.h +++ b/notebookview.h @@ -32,6 +32,12 @@ public: int zoom() const; + QSize getCurPageSize() const; + QRect getCurPageTrim() const; + + QImage exportPage(int pageNum) const; + void renderPage(QPainter *painter, int pageNum, const QRectF &target = QRectF(), const QRectF &source = QRectF()) const; + void requestPaperReplay(const QString &file, qint64 time); signals: diff --git a/paperreplay.cc b/paperreplay.cc index 5baeac7..f2d5b20 100644 --- a/paperreplay.cc +++ b/paperreplay.cc @@ -142,8 +142,10 @@ bool PaperReplay::open(const QString &path, quint64 notebookGuid) if (!parseSessionInfo(session.d, sessionDir.filePath("session.info"))) { qWarning() << "Could not parse:" << sessionDir.absoluteFilePath("session.info"); } - if (!parseSessionPages(session.d, sessionDir.filePath("session.pages"))) { - qWarning() << "Could not parse:" << sessionDir.absoluteFilePath("session.pages"); + if (sessionDir.exists("session.pages")) { + if (!parseSessionPages(session.d, sessionDir.filePath("session.pages"))) { + qWarning() << "Could not parse:" << sessionDir.absoluteFilePath("session.pages"); + } } if (!session.d->file.isEmpty()) { diff --git a/scribiu.desktop b/scribiu.desktop new file mode 100644 index 0000000..ef5cbe9 --- /dev/null +++ b/scribiu.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Name=Scribiu +GenericName=Livescribe Manager +Comment=Read notebooks and audio notes from your Livescribe pen +Exec=/usr/bin/scribiu +TryExec=/usr/bin/scribiu +Icon=scribiu +Terminal=false +Type=Application +Categories=Office; diff --git a/scribiu.pro b/scribiu.pro index 437e1ce..c85a260 100644 --- a/scribiu.pro +++ b/scribiu.pro @@ -1,4 +1,4 @@ -QT += core gui phonon +QT += core gui svg phonon greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -41,3 +41,17 @@ HEADERS += mainwindow.h \ paperreplaymodel.h FORMS += mainwindow.ui + +isEmpty(PREFIX) { + PREFIX = /usr +} + +target.path = $$PREFIX/bin + +icon.path = $$PREFIX/share/icons/hicolor/scalable/apps +icon.files = scribiu.svg + +desktop.path = $$PREFIX/share/applications +desktop.files = scribiu.desktop + +INSTALLS += target icon desktop diff --git a/scribiu.svg b/scribiu.svg new file mode 100644 index 0000000..97a453d --- /dev/null +++ b/scribiu.svg @@ -0,0 +1,553 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + inkscape:export-ydpi="90.000000" + inkscape:export-xdpi="90.000000" + inkscape:export-filename="/home/jimmac/Desktop/wi-fi.png" + width="48" + height="48" + id="svg11300" + sodipodi:version="0.32" + inkscape:version="0.91 r13725" + sodipodi:docname="icon.svg" + version="1.0" + inkscape:r_cx="true" + inkscape:r_cy="true"> + <defs + id="defs3"> + <linearGradient + id="linearGradient4246"> + <stop + id="stop4248" + offset="0" + style="stop-color:#a0a0a0;stop-opacity:1" /> + <stop + style="stop-color:#bfbfbf;stop-opacity:1" + offset="0.31578946" + id="stop4250" /> + <stop + id="stop4252" + offset="1" + style="stop-color:#6e6e6e;stop-opacity:1" /> + </linearGradient> + <linearGradient + id="linearGradient4238"> + <stop + style="stop-color:#919191;stop-opacity:1" + offset="0" + id="stop4240" /> + <stop + id="stop4242" + offset="0.31578946" + style="stop-color:#b0b0b0;stop-opacity:1" /> + <stop + style="stop-color:#696969;stop-opacity:1" + offset="1" + id="stop4244" /> + </linearGradient> + <linearGradient + id="linearGradient4228"> + <stop + id="stop4230" + offset="0" + style="stop-color:#a0a0a0;stop-opacity:1" /> + <stop + style="stop-color:#bfbfbf;stop-opacity:1" + offset="0.31578946" + id="stop4232" /> + <stop + id="stop4234" + offset="1" + style="stop-color:#6e6e6e;stop-opacity:1" /> + </linearGradient> + <linearGradient + id="linearGradient4220"> + <stop + id="stop4222" + offset="0" + style="stop-color:#a0a0a0;stop-opacity:1" /> + <stop + style="stop-color:#bfbfbf;stop-opacity:1" + offset="0.31578946" + id="stop4224" /> + <stop + id="stop4226" + offset="1" + style="stop-color:#6e6e6e;stop-opacity:1" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + id="linearGradient9952"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop9954" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop9956" /> + </linearGradient> + <linearGradient + id="linearGradient9920"> + <stop + id="stop9922" + offset="0" + style="stop-color:#5b90c8;stop-opacity:1;" /> + <stop + style="stop-color:#8fb0d1;stop-opacity:1;" + offset="0.31578946" + id="stop9924" /> + <stop + id="stop9926" + offset="1" + style="stop-color:#34679d;stop-opacity:1;" /> + </linearGradient> + <linearGradient + id="linearGradient9910"> + <stop + style="stop-color:#729fcf;stop-opacity:1;" + offset="0" + id="stop9912" /> + <stop + id="stop9918" + offset="0.31578946" + style="stop-color:#a5bfda;stop-opacity:1;" /> + <stop + style="stop-color:#376ca4;stop-opacity:1;" + offset="1" + id="stop9914" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + id="linearGradient6395"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop6397" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop6399" /> + </linearGradient> + <linearGradient + id="linearGradient2994"> + <stop + style="stop-color:#000000;stop-opacity:1;" + offset="0" + id="stop2996" /> + <stop + style="stop-color:#c9c9c9;stop-opacity:1;" + offset="1" + id="stop2998" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + id="linearGradient2984"> + <stop + style="stop-color:#e7e2b8;stop-opacity:1;" + offset="0" + id="stop2986" /> + <stop + style="stop-color:#e7e2b8;stop-opacity:0;" + offset="1" + id="stop2988" /> + </linearGradient> + <linearGradient + id="linearGradient2974"> + <stop + style="stop-color:#c1c1c1;stop-opacity:1;" + offset="0" + id="stop2976" /> + <stop + style="stop-color:#acacac;stop-opacity:1;" + offset="1" + id="stop2978" /> + </linearGradient> + <linearGradient + id="linearGradient2966"> + <stop + style="stop-color:#ffd1d1;stop-opacity:1;" + offset="0" + id="stop2968" /> + <stop + id="stop3006" + offset="0.5" + style="stop-color:#ff1d1d;stop-opacity:1;" /> + <stop + style="stop-color:#6f0000;stop-opacity:1;" + offset="1" + id="stop2970" /> + </linearGradient> + <linearGradient + id="linearGradient5068"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop5070" /> + <stop + id="stop5078" + offset="0.32894737" + style="stop-color:#ffffff;stop-opacity:0.69;" /> + <stop + id="stop5076" + offset="0.65789473" + style="stop-color:#c2c2c2;stop-opacity:0.34;" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop5072" /> + </linearGradient> + <linearGradient + id="linearGradient5058"> + <stop + style="stop-color:#959791;stop-opacity:1;" + offset="0" + id="stop5060" /> + <stop + id="stop5066" + offset="0.5" + style="stop-color:#f8f8f8;stop-opacity:1;" /> + <stop + style="stop-color:#8c8c8c;stop-opacity:1;" + offset="1" + id="stop5062" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + id="linearGradient5048"> + <stop + style="stop-color:#000000;stop-opacity:1;" + offset="0" + id="stop5050" /> + <stop + style="stop-color:#000000;stop-opacity:0;" + offset="1" + id="stop5052" /> + </linearGradient> + <linearGradient + id="linearGradient5036"> + <stop + style="stop-color:#f5f5f5;stop-opacity:0.09;" + offset="0" + id="stop5038" /> + <stop + id="stop5044" + offset="0.2631579" + style="stop-color:#ffffff;stop-opacity:0.89999998;" /> + <stop + style="stop-color:#c7c7c7;stop-opacity:0.46000001;" + offset="0.74792242" + id="stop5088" /> + <stop + style="stop-color:#ffffff;stop-opacity:0.78039217;" + offset="1" + id="stop5040" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient5036" + id="linearGradient5042" + x1="15.375" + y1="26.0846" + x2="34.250416" + y2="26.0846" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(0,5.625)" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient5048" + id="radialGradient5054" + cx="23.25" + cy="37.75" + fx="23.25" + fy="37.75" + r="14.875" + gradientTransform="matrix(1,0,0,0.420168,0,21.88866)" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient5058" + id="linearGradient5064" + x1="30.875" + y1="19.4596" + x2="15.625" + y2="19.0846" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(0,5.625)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient5068" + id="linearGradient5074" + x1="11.75" + y1="14.1875" + x2="37.625" + y2="14.1875" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient2966" + id="linearGradient6343" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(5.259571e-3,0.999987,0.999987,-5.259571e-3,42.9955,-2.496241)" + x1="48.90625" + y1="17.376184" + x2="50.988335" + y2="22.250591" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient2974" + id="linearGradient6345" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(5.259571e-3,0.999987,0.999987,-5.259571e-3,42.99552,-2.496241)" + x1="46" + y1="19.8125" + x2="47.6875" + y2="22.625" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient2984" + id="radialGradient6347" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1.53767e-2,2.923527,2.029691,-1.067544e-2,20.39098,-69.72665)" + cx="29.053354" + cy="27.640751" + fx="29.053354" + fy="27.640751" + r="3.2408545" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient2994" + id="linearGradient6349" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(5.259571e-3,0.999987,0.999987,-5.259571e-3,48.6929,-14.14491)" + x1="25.71875" + y1="31.046875" + x2="25.514589" + y2="30.703125" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient5048" + id="radialGradient6353" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1,0,0,0.420168,8.187895e-16,21.88866)" + cx="23.25" + cy="37.75" + fx="23.25" + fy="37.75" + r="14.875" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient6395" + id="linearGradient6401" + x1="20.064156" + y1="27.140348" + x2="20.682873" + y2="44.110912" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient9952" + id="linearGradient9961" + gradientUnits="userSpaceOnUse" + x1="55.876038" + y1="62.401989" + x2="38.061356" + y2="62.827091" + gradientTransform="matrix(-0.493304,-0.716654,0.716654,-0.493304,-9.26781,79.4192)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient9910" + id="linearGradient9965" + gradientUnits="userSpaceOnUse" + x1="28.244684" + y1="60.445503" + x2="28.244684" + y2="68.224884" + gradientTransform="matrix(-0.493304,-0.716654,0.716654,-0.493304,-9.26781,79.4192)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient9920" + id="linearGradient9968" + gradientUnits="userSpaceOnUse" + x1="28.244684" + y1="60.445503" + x2="28.244684" + y2="68.224884" + gradientTransform="matrix(-0.493304,-0.716654,0.716654,-0.493304,-9.26781,79.4192)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient9910" + id="linearGradient9972" + gradientUnits="userSpaceOnUse" + x1="28.244684" + y1="60.445503" + x2="28.244684" + y2="68.224884" + gradientTransform="matrix(-0.493304,-0.716654,0.716654,-0.493304,-9.26781,79.4192)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4220" + id="linearGradient3119" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.493304,-0.716654,-0.716654,-0.493304,51.767278,81.4192)" + x1="28.244684" + y1="60.445503" + x2="28.244684" + y2="68.224884" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4238" + id="linearGradient3121" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.493304,-0.716654,-0.716654,-0.493304,51.767278,81.4192)" + x1="28.244684" + y1="60.445503" + x2="28.244684" + y2="68.224884" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4228" + id="linearGradient3125" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.493304,-0.716654,-0.716654,-0.493304,51.767278,81.4192)" + x1="55.876038" + y1="62.401989" + x2="38.061356" + y2="62.827091" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient9910" + id="linearGradient4294" + x1="30.649073" + y1="20.050009" + x2="46.750927" + y2="20.050009" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(-4.8,-11.4)" /> + </defs> + <sodipodi:namedview + stroke="#ef2929" + fill="#eeeeec" + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="0.25490196" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="20" + inkscape:cx="29.291033" + inkscape:cy="24.089135" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:grid-bbox="true" + inkscape:document-units="px" + inkscape:showpageshadow="false" + inkscape:window-width="1642" + inkscape:window-height="1002" + inkscape:window-x="38" + inkscape:window-y="25" + width="48px" + height="48px" + objecttolerance="1" + inkscape:object-nodes="false" + inkscape:has_abs_tolerance="false" + inkscape:window-maximized="1" /> + <metadata + id="metadata4"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:creator> + <cc:Agent> + <dc:title>Jakub Steiner</dc:title> + </cc:Agent> + </dc:creator> + <dc:source>http://jimmac.musichall.cz</dc:source> + <cc:license + rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" /> + <dc:title /> + <dc:subject> + <rdf:Bag> + <rdf:li>office</rdf:li> + <rdf:li>applications</rdf:li> + <rdf:li>category</rdf:li> + </rdf:Bag> + </dc:subject> + </cc:Work> + <cc:License + rdf:about="http://creativecommons.org/licenses/by-sa/2.0/"> + <cc:permits + rdf:resource="http://web.resource.org/cc/Reproduction" /> + <cc:permits + rdf:resource="http://web.resource.org/cc/Distribution" /> + <cc:requires + rdf:resource="http://web.resource.org/cc/Notice" /> + <cc:requires + rdf:resource="http://web.resource.org/cc/Attribution" /> + <cc:permits + rdf:resource="http://web.resource.org/cc/DerivativeWorks" /> + <cc:requires + rdf:resource="http://web.resource.org/cc/ShareAlike" /> + </cc:License> + </rdf:RDF> + </metadata> + <g + id="layer1" + inkscape:label="Layer 1" + inkscape:groupmode="layer" + inkscape:r_cx="true" + inkscape:r_cy="true"> + <path + inkscape:connector-curvature="0" + style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#e7e7e7;fill-opacity:1;fill-rule:evenodd;stroke:#7d7d7d;stroke-width:0.99999958;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;marker:none" + d="m 18.922824,31.002754 c -0.882411,-0.607402 -3.380814,1.584711 -5.631979,4.855122 -2.251165,3.270411 -2.718833,6.860367 -2.524417,6.994192 0.216678,0.149149 3.380814,-1.584711 5.63198,-4.855122 2.251165,-3.270411 3.406828,-6.38679 2.524416,-6.994192 z" + id="path9903" + sodipodi:nodetypes="cszsc" + inkscape:r_cx="true" + inkscape:r_cy="true" /> + <path + inkscape:connector-curvature="0" + style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:url(#linearGradient3119);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.9999997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + d="m 24.189972,29.045877 c -2.941809,4.15471 -5.832829,7.753007 -8.218557,10.338669 -0.711252,0.62297 -2.722505,1.945941 -3.633757,1.26891 C 11.259739,39.843093 11.78182,37.63273 12.103901,36.722367 13.86523,33.171968 16.608326,28.577556 19.934459,23.745472 25.938374,15.023204 31.89203,8.3782899 34.246967,7.5900109 c 0.07227,-0.022903 0.169188,-0.053053 0.234388,-0.064485 0.04584,-0.00698 0.113748,-0.00461 0.155869,-0.00562 0.06619,3.061e-4 0.151055,0.013972 0.207436,0.029876 0.01378,0.00447 0.05599,0.0045 0.06915,0.00996 0.01284,0.00596 0.03936,0.02854 0.05157,0.035496 0.0059,0.00373 0.02,0.013768 0.02578,0.017748 0.0058,0.00398 0.02018,0.013528 0.02578,0.017748 0.01085,0.00892 0.04142,0.025629 0.05157,0.035496 0.0098,0.010339 0.02489,0.049754 0.03399,0.061033 0.03498,0.046987 0.07805,0.1213803 0.101966,0.1830988 0.01409,0.039707 0.04056,0.1022948 0.0504,0.1476043 0.0126,0.064979 0.01904,0.1662731 0.02344,0.2419582 0.104434,2.4811718 -3.976976,10.4148338 -9.980891,19.1371018 -0.373577,0.542718 -0.735225,1.083169 -1.107443,1.608851 z" + id="path9898" + inkscape:r_cx="true" + inkscape:r_cy="true" + sodipodi:nodetypes="scccscccccccccccccss" /> + <path + inkscape:connector-curvature="0" + style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:url(#linearGradient3121);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.9999997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + d="m 28.75569,22.854607 c -0.747047,1.047569 -1.520954,2.05411 -2.255907,3.001276 -1.22201,0.159 -3.126011,0.205203 -3.981433,-0.45357 -0.921219,-0.837368 -1.104049,-2.041324 -1.433088,-3.273479 0.885239,-1.457513 1.868325,-2.99026 2.929731,-4.532232 5.065803,-7.359414 10.292894,-12.8246735 12.542954,-13.3086927 0.01977,-0.00391 0.06743,-0.012463 0.08672,-0.015579 0.01906,-0.00272 0.06815,-0.013658 0.08672,-0.015579 0.04584,-0.0038 0.113077,-0.00687 0.155869,-0.00562 0.01687,9.059e-4 0.05277,0.00824 0.06914,0.00996 0.04836,0.0064 0.120291,0.023809 0.164075,0.037665 0.01434,0.00504 0.05533,0.00408 0.06914,0.00996 0.02033,0.00944 0.05821,0.041893 0.07735,0.053243 0.0063,0.004 0.01967,0.013539 0.02578,0.017748 0.0061,0.00421 0.01982,0.013338 0.02578,0.017748 0.01744,0.013832 0.06127,0.037624 0.07735,0.053244 0.01042,0.010808 0.02417,0.049439 0.03399,0.061033 0.02857,0.035951 0.07052,0.096923 0.09376,0.1398139 0.0074,0.014677 0.02712,0.045598 0.03399,0.061033 0.01644,0.039528 0.03758,0.1034227 0.0504,0.1476038 0.0048,0.018039 0.01215,0.067799 0.01641,0.08657 0.004,0.019135 0.013,0.066711 0.01641,0.08657 0.351197,2.274578 -2.887701,9.108397 -7.953505,16.467811 -0.315205,0.457918 -0.616093,0.910969 -0.931657,1.353477 z" + id="path9893" + inkscape:r_cx="true" + inkscape:r_cy="true" + sodipodi:nodetypes="ccccscccccccccccccccccscc" /> + <path + inkscape:connector-curvature="0" + inkscape:r_cy="true" + inkscape:r_cx="true" + style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.35714285;fill:none;stroke:url(#linearGradient3125);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + d="m 27.081744,23.244088 c -0.188826,0.267315 -1.128133,1.616373 -1.31571,1.878152 -0.724932,0.01933 -1.699864,0.238657 -2.774797,-0.192014 C 22.416305,24.132888 22.091373,23.58555 22.016441,22.538212 22.529594,21.75987 24.00314,19.390277 24.542686,18.581053 30.75449,9.2644337 36.842616,4.6091151 37.096428,4.7829476 37.375624,4.9741649 34.931936,12.260041 28.599106,21.06121 c -0.37182,0.516743 -1.159586,1.676387 -1.517362,2.182878 z" + id="path9930" + sodipodi:nodetypes="ccccszsc" /> + <path + inkscape:connector-curvature="0" + inkscape:r_cy="true" + inkscape:r_cx="true" + style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.58399999;fill:url(#linearGradient4294);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + d="m 34.01437,11.047968 c -0.638826,1.267315 -2.478133,4.966373 -4.26571,7.128152 -1.020575,-0.956918 -1.814264,-1.47078 -2.849593,-1.934028 l 4.826245,-6.407159 c 1.05717,-0.09913 1.780931,0.19205 2.289058,1.213035 z" + id="path9930-9" + sodipodi:nodetypes="ccccc" /> + </g> +</svg> diff --git a/smartpensyncer.cc b/smartpensyncer.cc index fe7a281..93331ef 100644 --- a/smartpensyncer.cc +++ b/smartpensyncer.cc @@ -4,6 +4,7 @@ #include <QtCore/QDebug> #include <QtGui/QDesktopServices> #include <quazip/quazipfile.h> +#include "paperreplay.h" #include "smartpensyncer.h" #define BUFFER_SIZE 16 * 1024 @@ -152,7 +153,7 @@ bool SmartpenSyncer::syncNotebook(const Smartpen::ChangeReport &change) bool SmartpenSyncer::syncPaperReplay() { - QDir replayDir(_penDataDir.filePath("PaperReplay")); + QDir replayDir(_penDataDir.filePath(PAPER_REPLAY)); if (!replayDir.exists()) { if (!replayDir.mkpath(".")) { qWarning() << "Cannot create PaperReplay data directory:" << replayDir.absolutePath(); |