diff --git a/cubiomes-viewer.pro b/cubiomes-viewer.pro
index fddf446..da1e74c 100644
--- a/cubiomes-viewer.pro
+++ b/cubiomes-viewer.pro
@@ -236,4 +236,8 @@ with_network: {
HEADERS += src/updater.h
}
-
+# enable dbus features with: qmake CONFIG+=with_dbus
+with_dbus: {
+ QT += dbus
+ DEFINES += "WITH_DBUS=1"
+}
diff --git a/etc/com.github.cubitect.cubiomes-viewer.metainfo.xml b/etc/com.github.cubitect.cubiomes-viewer.metainfo.xml
index adaf895..4d284b3 100644
--- a/etc/com.github.cubitect.cubiomes-viewer.metainfo.xml
+++ b/etc/com.github.cubitect.cubiomes-viewer.metainfo.xml
@@ -17,9 +17,8 @@
Changes:
- - Added progress indication via app icon
- - Tweaked app icon
- - Tweaked sceenshots
+ - Fixed search progress not loading properly when stopped on a negative seed
+ - Tweaked app icon and screenshots
- Tweaked default layout
diff --git a/src/config.cpp b/src/config.cpp
index b8224e0..07ae833 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -525,7 +525,7 @@ bool SearchConfig::read(const QString& line)
if (sscanf(p, "#Search: %d", &searchtype) == 1) return true;
if (line.startsWith("#List64: ")) { slist64path = line.mid(11).trimmed(); return true; }
if (sscanf(p, "#Threads: %d", &threads) == 1) return true;
- if (sscanf(p, "#Progress: %" PRId64, &startseed) == 1) return true;
+ if (sscanf(p, "#Progress: %" PRIu64, &startseed) == 1) return true;
if (sscanf(p, "#ResStop: %d", &tmp) == 1) { stoponres = tmp; return true; }
if (sscanf(p, "#SMin: %" PRIu64, &smin) == 1) return true;
if (sscanf(p, "#SMax: %" PRIu64, &smax) == 1) return true;
diff --git a/src/main.cpp b/src/main.cpp
index a90e2b8..8c68fed 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5,6 +5,7 @@
#include "world.h"
#include
+#include
#include
#include
#include
@@ -116,6 +117,7 @@ int main(int argc, char *argv[])
}
else
{
+ QGuiApplication::setDesktopFileName("com.github.cubitect.cubiomes-viewer");
QApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, false);
QApplication app(argc, argv);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 7ce16af..a5618e1 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -36,6 +36,12 @@
#include
#include
#include
+#include
+
+#if WITH_DBUS
+#include
+#include
+#endif
MainWindow::MainWindow(QString sessionpath, QString resultspath, QWidget *parent)
@@ -694,11 +700,29 @@ void MainWindow::setBiomeColorRc(QString rc)
void MainWindow::setProgressIndication(double value)
{
- int v = (int) floor(100 * value);
+ int v = (int) floor(10000 * value);
if (v == progval)
return;
progval = v;
+#if WITH_DBUS
+ auto message = QDBusMessage::createSignal("/", "com.canonical.Unity.LauncherEntry", "Update");
+ QVariantMap properties;
+ if (value >= 0 && value <= 1)
+ {
+ properties.insert("progress-visible", true);
+ properties.insert("progress", value);
+ }
+ else
+ {
+ properties.insert("progress-visible", false);
+ properties.insert("progress", 0);
+ }
+ message << QString("application://%1.desktop").arg(QGuiApplication::desktopFileName()) << properties;
+ QDBusConnection::sessionBus().send(message);
+#endif
+
+#if 0
QPixmap pixmap(":/icons/logo.png");
if (value >= 0 && value <= 1)
@@ -706,7 +730,7 @@ void MainWindow::setProgressIndication(double value)
QPainter painter(&pixmap);
QRect view = painter.viewport();
- QString txt = QString::asprintf("%2d", progval);
+ QString txt = QString::asprintf("%2d", progval / 100);
QFont f = font();
f.setPixelSize(48);
@@ -728,6 +752,7 @@ void MainWindow::setProgressIndication(double value)
}
setWindowIcon(QIcon(pixmap));
+#endif
}
void MainWindow::on_comboBoxMC_currentIndexChanged(int)