Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cubiomes-viewer.pro
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,7 @@ with_network: {
HEADERS += src/updater.h
}


with_dbus: {
QT += dbus
DEFINES += "WITH_DBUS=1"
}
32 changes: 32 additions & 0 deletions src/formsearchcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
#include <QClipboard>
#include <QFileDialog>
#include <QFontMetrics>
#include <QGuiApplication>

#if WITH_DBUS
#include <QDBusMessage>
#include <QDBusConnection>
#endif

QVariant SeedTableModel::data(const QModelIndex& index, int role) const
{
Expand Down Expand Up @@ -716,6 +721,15 @@ void FormSearchControl::searchProgressReset()

ui->progressBar->setValue(0);
ui->progressBar->setFormat(fmt);

#if WITH_DBUS
auto message = QDBusMessage::createSignal("/", "com.canonical.Unity.LauncherEntry", "Update");
QVariantMap properties;
properties.insert("progress-visible", false);
properties.insert("progress", 0);
message << QString("application://%1.desktop").arg(QGuiApplication::desktopFileName()) << properties;
QDBusConnection::sessionBus().send(message);
#endif
}

void FormSearchControl::updateSearchProgress(uint64_t prog, uint64_t end, int64_t seed)
Expand Down Expand Up @@ -746,6 +760,15 @@ void FormSearchControl::updateSearchProgress(uint64_t prog, uint64_t end, int64_
}
}
ui->progressBar->setFormat(fmt);

#if WITH_DBUS
auto message = QDBusMessage::createSignal("/", "com.canonical.Unity.LauncherEntry", "Update");
QVariantMap properties;
properties.insert("progress-visible", true);
properties.insert("progress", (double) v / 10000);
message << QString("application://%1.desktop").arg(QGuiApplication::desktopFileName()) << properties;
QDBusConnection::sessionBus().send(message);
#endif
}
}

Expand All @@ -759,6 +782,15 @@ void FormSearchControl::searchFinish(bool done)
ui->lineStart->setText(QString::asprintf("%" PRId64, sthread.smax));
ui->progressBar->setValue(10000);
ui->progressBar->setFormat(tr("Done", "Progressbar"));

#if WITH_DBUS
auto message = QDBusMessage::createSignal("/", "com.canonical.Unity.LauncherEntry", "Update");
QVariantMap properties;
properties.insert("progress-visible", false);
properties.insert("progress", 0);
message << QString("application://%1.desktop").arg(QGuiApplication::desktopFileName()) << properties;
QDBusConnection::sessionBus().send(message);
#endif
}
ui->labelStatus->setText(tr("Idle", "Progressbar"));
searchLockUi(false);
Expand Down
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ int main(int argc, char *argv[])
}
else
{
QGuiApplication::setDesktopFileName("com.github.cubitect.cubiomes-viewer");
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
QApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, false);
Expand Down