Take out of beta testing, use D-Bus rather than drop files.
This commit is contained in:
parent
953908831e
commit
978e9bfa5f
@ -9,8 +9,8 @@ set(CMAKE_AUTORCC ON)
|
|||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets LinguistTools)
|
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets DBus LinguistTools)
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools)
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets DBus LinguistTools)
|
||||||
|
|
||||||
set(TS_FILES
|
set(TS_FILES
|
||||||
src/translations/lubuntu-update_en_US.ts
|
src/translations/lubuntu-update_en_US.ts
|
||||||
@ -36,14 +36,14 @@ set(PROJECT_SOURCES
|
|||||||
src/conffilehandlerdialog.h
|
src/conffilehandlerdialog.h
|
||||||
src/conffilehandlerdialog.cpp
|
src/conffilehandlerdialog.cpp
|
||||||
src/conffilehandlerdialog.ui
|
src/conffilehandlerdialog.ui
|
||||||
src/ipcfilewatcher.h
|
|
||||||
src/ipcfilewatcher.cpp
|
|
||||||
src/releaseupgradewindow.h
|
src/releaseupgradewindow.h
|
||||||
src/releaseupgradewindow.cpp
|
src/releaseupgradewindow.cpp
|
||||||
src/releaseupgradewindow.ui
|
src/releaseupgradewindow.ui
|
||||||
src/upgradedelaywindow.h
|
src/upgradedelaywindow.h
|
||||||
src/upgradedelaywindow.cpp
|
src/upgradedelaywindow.cpp
|
||||||
src/upgradedelaywindow.ui
|
src/upgradedelaywindow.ui
|
||||||
|
src/windowshowwatcher.h
|
||||||
|
src/windowshowwatcher.cpp
|
||||||
${TS_FILES}
|
${TS_FILES}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -63,7 +63,9 @@ add_executable(lubuntu-update
|
|||||||
|
|
||||||
add_dependencies(lubuntu-update translations)
|
add_dependencies(lubuntu-update translations)
|
||||||
|
|
||||||
target_link_libraries(lubuntu-update PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
|
target_link_libraries(lubuntu-update PRIVATE
|
||||||
|
Qt${QT_VERSION_MAJOR}::Widgets
|
||||||
|
Qt${QT_VERSION_MAJOR}::DBus)
|
||||||
|
|
||||||
install(TARGETS lubuntu-update
|
install(TARGETS lubuntu-update
|
||||||
BUNDLE DESTINATION .
|
BUNDLE DESTINATION .
|
||||||
|
8
debian/changelog
vendored
8
debian/changelog
vendored
@ -1,3 +1,11 @@
|
|||||||
|
lubuntu-update-notifier (1.0.0) noble; urgency=medium
|
||||||
|
|
||||||
|
* Change from beta to final release.
|
||||||
|
* Use D-Bus as a window show trigger rather than clunky drop files, this
|
||||||
|
will prevent issues if multiple users are logged in at once.
|
||||||
|
|
||||||
|
-- Aaron Rainbolt <arraybolt3@ubuntu.com> Mon, 25 Mar 2024 16:15:49 -0500
|
||||||
|
|
||||||
lubuntu-update-notifier (1.0.0~beta1) noble; urgency=medium
|
lubuntu-update-notifier (1.0.0~beta1) noble; urgency=medium
|
||||||
|
|
||||||
* Change from alpha to beta testing phase, this has been tested for a while
|
* Change from alpha to beta testing phase, this has been tested for a while
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
#include "ipcfilewatcher.h"
|
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QDir>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QFileSystemWatcher>
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
IPCFileWatcher::IPCFileWatcher(QObject *parent)
|
|
||||||
: QObject{parent}
|
|
||||||
{
|
|
||||||
QDir targetDir("/dev/shm/lubuntu-update");
|
|
||||||
bool couldRemove = targetDir.removeRecursively();
|
|
||||||
if (!couldRemove) {
|
|
||||||
qCritical() << "Could not clear IPC directory. Ensure that /dev/shm and /dev/shm/lubuntu-update are world-readable and world-writable.";
|
|
||||||
initFailed = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
targetDir.mkdir("/dev/shm/lubuntu-update");
|
|
||||||
QFileSystemWatcher *watcher = new QFileSystemWatcher(QStringList() << "/dev/shm/lubuntu-update");
|
|
||||||
connect(watcher, &QFileSystemWatcher::directoryChanged, this, &IPCFileWatcher::checkForShowWindowFile);
|
|
||||||
initFailed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IPCFileWatcher::didInitFail()
|
|
||||||
{
|
|
||||||
return initFailed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IPCFileWatcher::checkForShowWindowFile()
|
|
||||||
{
|
|
||||||
QFile flagFile("/dev/shm/lubuntu-update/lubuntu-update-show-win");
|
|
||||||
if (flagFile.exists()) {
|
|
||||||
flagFile.remove();
|
|
||||||
emit showWindowFlagDetected();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
#ifndef IPCFILEWATCHER_H
|
|
||||||
#define IPCFILEWATCHER_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
class IPCFileWatcher : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit IPCFileWatcher(QObject *parent = nullptr);
|
|
||||||
bool didInitFail();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void showWindowFlagDetected();
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool initFailed;
|
|
||||||
|
|
||||||
void checkForShowWindowFile();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // IPCFILEWATCHER_H
|
|
40
src/main.cpp
40
src/main.cpp
@ -1,9 +1,13 @@
|
|||||||
#include "ipcfilewatcher.h"
|
#include "windowshowwatcher.h"
|
||||||
#include "orchestrator.h"
|
#include "orchestrator.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "conffilehandlerdialog.h"
|
#include "conffilehandlerdialog.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QDBusConnection>
|
||||||
|
#include <QDBusError>
|
||||||
|
#include <QDBusInterface>
|
||||||
|
#include <QDebug>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
@ -43,15 +47,20 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Connect to D-Bus.
|
||||||
|
auto dbusConnection = QDBusConnection::sessionBus();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If Lubuntu Update is already running, create
|
* If Lubuntu Update is already running, instruct the running instance to
|
||||||
* /dev/shm/lubuntu-update/lubuntu-update-show-win and exit. This will
|
* display its window via the D-Bus connection.
|
||||||
* trigger the existing process to pop up a window.
|
|
||||||
*/
|
*/
|
||||||
if (detectProc("lubuntu-update", 2)) {
|
if (detectProc("lubuntu-update", 2)) {
|
||||||
QFile flagFile("/dev/shm/lubuntu-update/lubuntu-update-show-win");
|
auto iface = new QDBusInterface("me.lubuntu.LubuntuUpdate.window", "/", "me.lubuntu.LubuntuUpdate.window", dbusConnection);
|
||||||
flagFile.open(QFile::WriteOnly);
|
if (!iface->isValid()) {
|
||||||
flagFile.close();
|
qWarning().noquote() << dbusConnection.lastError().message();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iface->call("showWindow");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,15 +85,15 @@ int main(int argc, char *argv[])
|
|||||||
a.setQuitOnLastWindowClosed(false);
|
a.setQuitOnLastWindowClosed(false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IPCFileWatcher just watches the /dev/shm/lubuntu-update folder for the
|
* WindowShowWatcher is a very simple D-Bus service that allow triggering
|
||||||
* creation of a lubuntu-update-show-win file. If it detects it, it
|
* the Lubuntu Update window to be shown. If anything calls "showWindow"
|
||||||
* immediately deletes it and emits a signal. This is then used later to
|
* on this service, Lubuntu Update's window will pop up.
|
||||||
* cause the updater window to pop up.
|
|
||||||
*/
|
*/
|
||||||
|
QObject obj;
|
||||||
|
auto *wsw = new WindowShowWatcher(&obj);
|
||||||
|
dbusConnection.registerObject("/", &obj);
|
||||||
|
|
||||||
IPCFileWatcher *p = new IPCFileWatcher();
|
if (!dbusConnection.registerService("me.lubuntu.LubuntuUpdate.window")) {
|
||||||
|
|
||||||
if (p->didInitFail()) {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,10 +108,9 @@ int main(int argc, char *argv[])
|
|||||||
* there's no need to do anything with this except create it and then
|
* there's no need to do anything with this except create it and then
|
||||||
* start the event loop.
|
* start the event loop.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Orchestrator *o = new Orchestrator();
|
Orchestrator *o = new Orchestrator();
|
||||||
|
|
||||||
QObject::connect(p, &IPCFileWatcher::showWindowFlagDetected, o, &Orchestrator::displayUpdater);
|
QObject::connect(wsw, &WindowShowWatcher::showWindowTriggered, o, &Orchestrator::displayUpdater);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is an artifact from testing the conffile handler window. You can
|
* This is an artifact from testing the conffile handler window. You can
|
||||||
|
6
src/windowshowwatcher.cpp
Normal file
6
src/windowshowwatcher.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include "windowshowwatcher.h"
|
||||||
|
|
||||||
|
void WindowShowWatcher::showWindow()
|
||||||
|
{
|
||||||
|
emit showWindowTriggered();
|
||||||
|
}
|
23
src/windowshowwatcher.h
Normal file
23
src/windowshowwatcher.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef WINDOWSHOWWATCHER_H
|
||||||
|
#define WINDOWSHOWWATCHER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QDBusAbstractAdaptor>
|
||||||
|
#include <QDBusVariant>
|
||||||
|
|
||||||
|
class WindowShowWatcher : public QDBusAbstractAdaptor
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_CLASSINFO("D-Bus Interface", "me.lubuntu.LubuntuUpdate.window")
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit WindowShowWatcher(QObject *obj) : QDBusAbstractAdaptor(obj) {}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void showWindow();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void showWindowTriggered();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // WINDOWSHOWWATCHER_H
|
Loading…
x
Reference in New Issue
Block a user