diff --git a/harbour-seaprint.pro b/harbour-seaprint.pro
index c8fa873..c6168aa 100644
--- a/harbour-seaprint.pro
+++ b/harbour-seaprint.pro
@@ -36,6 +36,7 @@ DISTFILES += qml/harbour-seaprint.qml \
qml/pages/*.qml \
qml/pages/*.js \
qml/pages/*svg \
+ qml/pages/BusyPage.qml \
qml/pages/DebugPage.qml \
rpm/harbour-seaprint.changes.in \
rpm/harbour-seaprint.changes.run.in \
diff --git a/qml/pages/BusyPage.qml b/qml/pages/BusyPage.qml
new file mode 100644
index 0000000..ed1d7cd
--- /dev/null
+++ b/qml/pages/BusyPage.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+import "utils.js" as Utils
+
+Page {
+ property var printer
+ backNavigation: false
+ Connections {
+ target: printer
+ onJobFinished: {
+ var msg = ""
+ if (printer.jobAttrs.hasOwnProperty("job-state-message") && printer.jobAttrs["job-state-message"].value != "") {
+ msg = printer.jobAttrs["job-state-message"].value
+ }
+ else if (printer.jobAttrs.hasOwnProperty("job-state")) {
+ msg = Utils.ippName("job-state", printer.jobAttrs["job-state"].value)
+ }
+ if(status == true) {
+ notifier.notify(qsTr("Print success: ") + msg)
+ pageStack.pop() //or replace?
+ }
+ else {
+ notifier.notify(qsTr("Print failed: ") + msg)
+ }
+ }
+ }
+
+ BusyLabel {
+ text: printer.busyMessage
+ running: true
+ }
+}
diff --git a/qml/pages/PrinterPage.qml b/qml/pages/PrinterPage.qml
index f0b1692..b888f5d 100644
--- a/qml/pages/PrinterPage.qml
+++ b/qml/pages/PrinterPage.qml
@@ -12,26 +12,6 @@ Page {
console.log(JSON.stringify(printer.attrs))
}
- Connections {
- target: printer
- onJobFinished: {
- var msg = ""
- if (printer.jobAttrs.hasOwnProperty("job-state-message") && printer.jobAttrs["job-state-message"].value != "") {
- msg = printer.jobAttrs["job-state-message"].value
- }
- else if (printer.jobAttrs.hasOwnProperty("job-state")) {
- msg = Utils.ippName("job-state", printer.jobAttrs["job-state"].value)
- }
- if(status == true) {
- notifier.notify(qsTr("Print success: ") + msg)
- pageStack.pop() //or replace?
- }
- else {
- notifier.notify(qsTr("Print failed: ") + msg)
- }
- }
- }
-
// To enable PullDownMenu, place our content in a SilicaFlickable
SilicaFlickable {
anchors.fill: parent
@@ -42,8 +22,8 @@ Page {
text: qsTr("Print")
onClicked: {
console.log(JSON.stringify(jobParams))
+ pageStack.replace(Qt.resolvedUrl("BusyPage.qml"),{printer:printer})
printer.print(jobParams, page.selectedFile)
-
}
}
}
diff --git a/src/convertworker.cpp b/src/convertworker.cpp
index 27b81cc..b173779 100644
--- a/src/convertworker.cpp
+++ b/src/convertworker.cpp
@@ -14,7 +14,7 @@ void ConvertWorker::convertPdf(QNetworkRequest request, QString filename,
QProcess* ppm2pwg = new QProcess(this);
- // Yo dwag, I heard you like programs...
+ // Yo dawg, I heard you like programs...
ppm2pwg->setProgram("harbour-seaprint");
ppm2pwg->setArguments({"ppm2pwg"});
QStringList env = {"HWRES_X="+HwResX_s, "HWRES_Y="+HwResY_s};
diff --git a/src/ippprinter.cpp b/src/ippprinter.cpp
index 51ab74f..d11346d 100644
--- a/src/ippprinter.cpp
+++ b/src/ippprinter.cpp
@@ -212,6 +212,9 @@ void IppPrinter::convertDone(QNetworkRequest request, QTemporaryFile* data)
{
connect(_print_nam, SIGNAL(finished(QNetworkReply*)), data, SLOT(deleteLater()));
data->open();
+
+ setBusyMessage("Transferring");
+
_print_nam->post(request, data);
}
@@ -314,6 +317,8 @@ void IppPrinter::print(QJsonObject attrs, QString filename){
qDebug() << tempfile->fileName();
tempfile->close();
+ setBusyMessage("Converting");
+
emit doConvertPdf(request, filename, target==UrfConvert, HwResX, HwResY, tempfile);
}
else
@@ -322,6 +327,8 @@ void IppPrinter::print(QJsonObject attrs, QString filename){
contents = contents.append(filedata);
file.close();
+ setBusyMessage("Transferring");
+
_print_nam->post(request, contents);
}
@@ -381,3 +388,8 @@ QUrl IppPrinter::httpUrl() {
return url;
}
+void IppPrinter::setBusyMessage(QString msg)
+{
+ _busyMessage = msg;
+ emit busyMessageChanged();
+}
diff --git a/src/ippprinter.h b/src/ippprinter.h
index f36f848..e87ccd3 100644
--- a/src/ippprinter.h
+++ b/src/ippprinter.h
@@ -13,6 +13,7 @@ class IppPrinter : public QObject
Q_PROPERTY(QJsonObject attrs MEMBER _attrs NOTIFY attrsChanged)
Q_PROPERTY(QJsonObject jobAttrs MEMBER _jobAttrs NOTIFY jobAttrsChanged)
Q_PROPERTY(QJsonArray jobs MEMBER _jobs NOTIFY jobsChanged)
+ Q_PROPERTY(QString busyMessage MEMBER _busyMessage NOTIFY busyMessageChanged)
public:
@@ -53,6 +54,8 @@ signals:
void doConvertPdf(QNetworkRequest request, QString filename, bool urf, quint32 HwResX, quint32 HwResY, QTemporaryFile* tempfile);
+ void busyMessageChanged();
+
public slots:
void print(QJsonObject attrs, QString file);
@@ -74,6 +77,8 @@ private:
QJsonObject opAttrs();
+ void setBusyMessage(QString msg);
+
QNetworkAccessManager* _nam;
QNetworkAccessManager* _jobs_nam;
QNetworkAccessManager* _job_cancel_nam;
@@ -82,6 +87,7 @@ private:
QJsonObject _attrs;
QJsonObject _jobAttrs;
QJsonArray _jobs;
+ QString _busyMessage;
QThread _workerThread;
ConvertWorker* _worker;
diff --git a/translations/harbour-seaprint-de.ts b/translations/harbour-seaprint-de.ts
index 98d5b06..9c65b40 100644
--- a/translations/harbour-seaprint-de.ts
+++ b/translations/harbour-seaprint-de.ts
@@ -87,6 +87,17 @@
+
+ BusyPage
+
+
+
+
+
+
+
+
+
CoverPage
@@ -198,14 +209,6 @@
-
-
-
-
-
-
-
-
utils
diff --git a/translations/harbour-seaprint-es.ts b/translations/harbour-seaprint-es.ts
index ee45ead..9548188 100644
--- a/translations/harbour-seaprint-es.ts
+++ b/translations/harbour-seaprint-es.ts
@@ -87,6 +87,17 @@
Desconocida
+
+ BusyPage
+
+
+ Impresión correcta:
+
+
+
+ Impresión fallida:
+
+
CoverPage
@@ -198,14 +209,6 @@
Resolución
-
-
- Impresión correcta:
-
-
-
- Impresión fallida:
-
utils
diff --git a/translations/harbour-seaprint-fr.ts b/translations/harbour-seaprint-fr.ts
index 714c3e1..17965e9 100644
--- a/translations/harbour-seaprint-fr.ts
+++ b/translations/harbour-seaprint-fr.ts
@@ -87,6 +87,17 @@
Inconnu
+
+ BusyPage
+
+
+ Impression réussie :
+
+
+
+ Échec de l'impression :
+
+
CoverPage
@@ -198,14 +209,6 @@
Résolution
-
-
- Impression réussie :
-
-
-
- Échec de l'impression :
-
utils
diff --git a/translations/harbour-seaprint-zh_CN.ts b/translations/harbour-seaprint-zh_CN.ts
index 5909123..1ab0d5e 100644
--- a/translations/harbour-seaprint-zh_CN.ts
+++ b/translations/harbour-seaprint-zh_CN.ts
@@ -87,6 +87,17 @@
未知
+
+ BusyPage
+
+
+ 打印成功:
+
+
+
+ 打印失败:
+
+
CoverPage
@@ -198,14 +209,6 @@
分辨率
-
-
- 打印成功:
-
-
-
- 打印失败:
-
utils
diff --git a/translations/harbour-seaprint.ts b/translations/harbour-seaprint.ts
index 4a02c1b..819ef1a 100644
--- a/translations/harbour-seaprint.ts
+++ b/translations/harbour-seaprint.ts
@@ -87,6 +87,17 @@
+
+ BusyPage
+
+
+
+
+
+
+
+
+
CoverPage
@@ -198,14 +209,6 @@
-
-
-
-
-
-
-
-
utils