aboutsummaryrefslogtreecommitdiff
path: root/smartpensyncer.h
diff options
context:
space:
mode:
Diffstat (limited to 'smartpensyncer.h')
-rw-r--r--smartpensyncer.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/smartpensyncer.h b/smartpensyncer.h
index ea31917..9dae5c0 100644
--- a/smartpensyncer.h
+++ b/smartpensyncer.h
@@ -19,6 +19,7 @@
#ifndef SMARTPENSYNCER_H
#define SMARTPENSYNCER_H
+#include <atomic>
#include <QtCore/QThread>
#include <QtCore/QDir>
#include "smartpen.h"
@@ -26,20 +27,20 @@
class SmartpenSyncer : public QThread
{
Q_OBJECT
+
public:
explicit SmartpenSyncer(const Smartpen::Address &addr, QObject *parent = 0);
~SmartpenSyncer();
Smartpen::Address penAddress() const;
- QString penName() const;
-
bool hasErrors() const;
signals:
- void penNameChanged();
+ void gotPenName(const QString &name);
public slots:
void abort();
+ void reset();
private:
void run();
@@ -48,13 +49,16 @@ private:
bool syncPaperReplay(Smartpen::PenTime lastSync, const Smartpen::ChangeReport &change);
bool extractZip(QByteArray &zipData, QDir &dir);
+private slots:
+ void handleLinkError(const QString &msg);
+
private:
- Smartpen::Address _addr;
- Smartpen *_pen;
- bool _errored;
- bool _aborted;
+ const Smartpen::Address _addr;
+ std::atomic<bool> _errored;
+ std::atomic<bool> _aborted;
- QString _penSerial;
+ // To be used only from this thread
+ Smartpen *_pen;
QString _penName;
QDir _penDataDir;
};