From 247b7d55be4c9caea3cbc05f6f543280f207d895 Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 14 Jun 2015 17:39:26 +0200 Subject: allow changing data path, improve icon --- icons/48x48/scribiu.png | Bin 1688 -> 1689 bytes icons/inkscape/scribiu.svg | 553 +++++++++++++++++++++++++++++++++++++++++++++ icons/scalable/scribiu.svg | 545 +++++++++++++++++++------------------------- main.cc | 9 +- mainwindow.cc | 5 + mainwindow.h | 1 + mainwindow.ui | 76 +++++-- notebookmodel.cc | 23 +- notebookmodel.h | 4 + smartpensyncer.cc | 4 +- 10 files changed, 880 insertions(+), 340 deletions(-) create mode 100644 icons/inkscape/scribiu.svg diff --git a/icons/48x48/scribiu.png b/icons/48x48/scribiu.png index ba596ca..eebbd4f 100644 Binary files a/icons/48x48/scribiu.png and b/icons/48x48/scribiu.png differ diff --git a/icons/inkscape/scribiu.svg b/icons/inkscape/scribiu.svg new file mode 100644 index 0000000..6329bff --- /dev/null +++ b/icons/inkscape/scribiu.svg @@ -0,0 +1,553 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + + + + office + applications + category + + + + + + + + + + + + + + + + + + + + + diff --git a/icons/scalable/scribiu.svg b/icons/scalable/scribiu.svg index 97a453d..11853ad 100644 --- a/icons/scalable/scribiu.svg +++ b/icons/scalable/scribiu.svg @@ -1,6 +1,4 @@ - - + id="svg11300" + height="48" + width="48"> + id="stop4248" /> + style="stop-color:#bfbfbf;stop-opacity:1" /> + id="stop4252" /> + style="stop-color:#919191;stop-opacity:1" /> + id="stop4242" /> + style="stop-color:#696969;stop-opacity:1" /> + id="stop4230" /> + style="stop-color:#bfbfbf;stop-opacity:1" /> + id="stop4234" /> + id="stop4222" /> + style="stop-color:#bfbfbf;stop-opacity:1" /> + id="stop4226" /> + style="stop-color:#ffffff;stop-opacity:1;" /> + style="stop-color:#ffffff;stop-opacity:0;" /> + id="stop9922" /> + style="stop-color:#8fb0d1;stop-opacity:1;" /> + id="stop9926" /> + style="stop-color:#729fcf;stop-opacity:1;" /> + id="stop9918" /> + style="stop-color:#376ca4;stop-opacity:1;" /> + style="stop-color:#ffffff;stop-opacity:1;" /> + style="stop-color:#ffffff;stop-opacity:0;" /> + style="stop-color:#000000;stop-opacity:1;" /> + style="stop-color:#c9c9c9;stop-opacity:1;" /> + style="stop-color:#e7e2b8;stop-opacity:1;" /> + style="stop-color:#e7e2b8;stop-opacity:0;" /> + style="stop-color:#c1c1c1;stop-opacity:1;" /> + style="stop-color:#acacac;stop-opacity:1;" /> + style="stop-color:#ffd1d1;stop-opacity:1;" /> + id="stop3006" /> + style="stop-color:#6f0000;stop-opacity:1;" /> + style="stop-color:#ffffff;stop-opacity:1;" /> + id="stop5078" /> + id="stop5076" /> + style="stop-color:#ffffff;stop-opacity:0;" /> + style="stop-color:#959791;stop-opacity:1;" /> + id="stop5066" /> + style="stop-color:#8c8c8c;stop-opacity:1;" /> + style="stop-color:#000000;stop-opacity:1;" /> + style="stop-color:#000000;stop-opacity:0;" /> + style="stop-color:#f5f5f5;stop-opacity:0.09;" /> + id="stop5044" /> + style="stop-color:#c7c7c7;stop-opacity:0.46000001;" /> + style="stop-color:#ffffff;stop-opacity:0.78039217;" /> + y2="26.0846" + x2="34.250416" + y1="26.0846" + x1="15.375" + id="linearGradient5042" + xlink:href="#linearGradient5036" /> + r="14.875" + fy="37.75" + fx="23.25" + cy="37.75" + cx="23.25" + id="radialGradient5054" + xlink:href="#linearGradient5048" /> + y2="19.0846" + x2="15.625" + y1="19.4596" + x1="30.875" + id="linearGradient5064" + xlink:href="#linearGradient5058" /> + x2="37.625" + y1="14.1875" + x1="11.75" + id="linearGradient5074" + xlink:href="#linearGradient5068" /> - + - + - + - + + fx="23.25" + cy="37.75" + cx="23.25" + gradientTransform="matrix(1,0,0,0.420168,8.187895e-16,21.88866)" + gradientUnits="userSpaceOnUse" + id="radialGradient6353" + xlink:href="#linearGradient5048" /> + x2="20.682873" + y1="27.140348" + x1="20.064156" + id="linearGradient6401" + xlink:href="#linearGradient6395" /> - + id="linearGradient9961" + xlink:href="#linearGradient9952" /> - - - + + + y1="60.445503" + x1="28.244684" + gradientUnits="userSpaceOnUse" + id="linearGradient9972" + xlink:href="#linearGradient9910" /> + + + y1="62.401989" + x1="55.876038" + gradientTransform="matrix(0.493304,-0.716654,-0.716654,-0.493304,51.767278,81.4192)" + gradientUnits="userSpaceOnUse" + id="linearGradient3125" + xlink:href="#linearGradient4228" /> + y2="20.050009" + x2="46.750927" + y1="20.050009" + x1="30.649073" + id="linearGradient4294" + xlink:href="#linearGradient9910" /> - @@ -477,7 +416,7 @@ http://jimmac.musichall.cz - + office @@ -504,50 +443,26 @@ + id="layer1"> + 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" + 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 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" + 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 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" + 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 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" + 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 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" + style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.8;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" /> diff --git a/main.cc b/main.cc index a080bdd..055aa7b 100644 --- a/main.cc +++ b/main.cc @@ -3,9 +3,14 @@ int main(int argc, char *argv[]) { - QApplication a(argc, argv); + QApplication app(argc, argv); + app.setOrganizationName("scribiu"); + app.setOrganizationDomain("com.javispedro.scribiu"); + app.setApplicationName("scribiu"); + app.setApplicationVersion("1.0"); + MainWindow w; w.show(); - return a.exec(); + return app.exec(); } diff --git a/mainwindow.cc b/mainwindow.cc index b49a8da..921abe2 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -321,3 +321,8 @@ QString MainWindow::formatDuration(qint64 time) return QString("%2:%3").arg(mins).arg(secs, 2, 10, fill); } } + +void MainWindow::handleAbout() +{ + QMessageBox::about(this, tr("About Scribiu"), tr("Read notebooks and audio notes from your Livescribe Echo pen")); +} diff --git a/mainwindow.h b/mainwindow.h index 72d8898..7ce6a1e 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -42,6 +42,7 @@ private slots: void handleMediaTick(qint64 time); void handlePensBeingSynchronizedChanged(); void handleExport(); + void handleAbout(); private: QString formatDuration(qint64 time); diff --git a/mainwindow.ui b/mainwindow.ui index 11f2aa6..83c5105 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -14,7 +14,9 @@ Scribiu - + + + @@ -347,7 +349,14 @@ + + + &Help + + + + @@ -368,12 +377,22 @@ - + + + &Export... + + + + + + About... + + @@ -441,8 +460,8 @@ 42 - 521 - 210 + 479 + 272 @@ -453,8 +472,8 @@ handleCurPageChanged() - 521 - 210 + 479 + 272 358 @@ -469,12 +488,12 @@ prevPage() - 341 - 42 + 273 + 57 - 521 - 210 + 479 + 272 @@ -485,12 +504,12 @@ nextPage() - 433 - 42 + 365 + 57 - 521 - 210 + 479 + 272 @@ -501,8 +520,8 @@ handlePaperReplayRequested(QString,qint64) - 521 - 193 + 479 + 255 358 @@ -517,8 +536,8 @@ handlePaperReplayPlay() - 341 - 343 + 273 + 358 358 @@ -533,8 +552,8 @@ handlePaperReplayPause() - 377 - 343 + 309 + 358 358 @@ -622,6 +641,22 @@ + + actionAbout + triggered() + MainWindow + handleAbout() + + + 358 + 193 + + + 358 + 192 + + + handleNotebookSelected(QModelIndex) @@ -632,5 +667,6 @@ handlePaperReplayPause() handlePaperReplaySelected(QModelIndex) handleExport() + handleAbout() diff --git a/notebookmodel.cc b/notebookmodel.cc index 2139ee7..6db93d1 100644 --- a/notebookmodel.cc +++ b/notebookmodel.cc @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -12,7 +13,7 @@ NotebookModel::NotebookModel(QObject *parent) : QAbstractItemModel(parent), - _dataDir(QDesktopServices::storageLocation(QDesktopServices::DataLocation)), + _dataDir(userDataDirectory()), _watcher() { if (!_dataDir.exists()) { @@ -25,6 +26,26 @@ NotebookModel::NotebookModel(QObject *parent) : refresh(); } +QString NotebookModel::defaultDataDirectory() +{ + QString path = QDesktopServices::storageLocation(QDesktopServices::DataLocation); + if (path.isEmpty()) { + path = QDir::home().absoluteFilePath(".scribiu"); + } + return path; +} + +QString NotebookModel::userDataDirectory() +{ + QSettings settings; + QString path = settings.value("data/directory").toString(); + if (path.isEmpty()) { + path = defaultDataDirectory(); + settings.setValue("data/directory", QString()); + } + return path; +} + QString NotebookModel::penDirectory(const QString &name) const { return _dataDir.filePath(name + ".pen"); diff --git a/notebookmodel.h b/notebookmodel.h index cbe94c6..2b6ad73 100644 --- a/notebookmodel.h +++ b/notebookmodel.h @@ -8,9 +8,13 @@ class NotebookModel : public QAbstractItemModel { Q_OBJECT + public: explicit NotebookModel(QObject *parent = 0); + static QString defaultDataDirectory(); + static QString userDataDirectory(); + QString penDirectory(const QString &name) const; QString notebookDirectory(const QString &penName, const QString &nbName) const; QString notebookDirectory(const QModelIndex &index) const; diff --git a/smartpensyncer.cc b/smartpensyncer.cc index 654b0eb..100b64b 100644 --- a/smartpensyncer.cc +++ b/smartpensyncer.cc @@ -2,9 +2,9 @@ #include #include #include -#include #include #include "paperreplay.h" +#include "notebookmodel.h" #include "smartpensyncer.h" #define BUFFER_SIZE 16 * 1024 @@ -89,7 +89,7 @@ void SmartpenSyncer::run() _penSerial = penInfo["penserial"].toString(); - _penDataDir.setPath(QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/" + _penName + ".pen"); + _penDataDir.setPath(NotebookModel::userDataDirectory() + "/" + _penName + ".pen"); if (!_penDataDir.exists()) { if (!_penDataDir.mkpath(".")) { qWarning() << "Cannot create pen data directory:" << _penDataDir.absolutePath(); -- cgit v1.2.3