mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
add docker files, improve dbus interface
This commit is contained in:
parent
5c56f813d2
commit
4625afa0b9
11
.docker/Dockerfile-arch
Normal file
11
.docker/Dockerfile-arch
Normal file
@ -0,0 +1,11 @@
|
||||
FROM base/archlinux
|
||||
|
||||
RUN pacman -Sy
|
||||
|
||||
# toolchain
|
||||
RUN pacman -S --noconfirm base-devel cmake extra-cmake-modules python
|
||||
# kf5 and qt5 libraries
|
||||
RUN pacman -S --noconfirm plasma-framework
|
||||
|
||||
# required by tests
|
||||
RUN pacman -S --noconfirm xorg-server-xvfb
|
12
.docker/Dockerfile-ubuntu
Normal file
12
.docker/Dockerfile-ubuntu
Normal file
@ -0,0 +1,12 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update
|
||||
# toolchain
|
||||
RUN apt-get install -y cmake extra-cmake-modules g++ git gettext
|
||||
# kf5 and qt5 libraries
|
||||
RUN apt-get install -y libkf5i18n-dev libkf5notifications-dev libkf5service-dev \
|
||||
libkf5windowsystem-dev plasma-framework-dev qtbase5-dev qtdeclarative5-dev \
|
||||
plasma-framework
|
||||
|
||||
# required by tests
|
||||
RUN apt-get install -y xvfb
|
14
.docker/build-arch.sh
Executable file
14
.docker/build-arch.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf build-arch
|
||||
mkdir build-arch
|
||||
|
||||
# build
|
||||
cd build-arch
|
||||
cmake -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_BUILD_TYPE=Optimization -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_FUTURE=ON -DBUILD_TESTING=ON ../sources
|
||||
make
|
||||
|
||||
# tests
|
||||
xvfb-run make test
|
18
.docker/build-ubuntu.sh
Executable file
18
.docker/build-ubuntu.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf build-ubuntu
|
||||
mkdir build-ubuntu
|
||||
|
||||
# patches
|
||||
git apply patches/qt5.6-qversionnumber.patch
|
||||
git apply patches/qt5.5-qstringlist-and-qinfo.patch
|
||||
|
||||
# build
|
||||
cd build-ubuntu
|
||||
cmake -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_BUILD_TYPE=Optimization -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_FUTURE=ON -DBUILD_TESTING=ON ../sources
|
||||
make
|
||||
|
||||
# tests
|
||||
xvfb-run make test
|
@ -1,20 +1,13 @@
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
language: cpp
|
||||
os:
|
||||
- linux
|
||||
env:
|
||||
- DOCKER_TAG="arcan1s/awesome-widgets"
|
||||
|
||||
before_script:
|
||||
- sudo apt-add-repository -y ppa:kubuntu-ppa/backports
|
||||
- sudo sed -i 's/trusty/wily/g' /etc/apt/sources.list
|
||||
- sudo sed -i 's/trusty/wily/g' /etc/apt/sources.list.d/kubuntu-ppa-backports-trusty.list
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get -y -qq -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install libkf5i18n-dev libkf5notifications-dev libkf5service-dev libkf5windowsystem-dev plasma-framework-dev qtbase5-dev qtdeclarative5-dev extra-cmake-modules cmake g++
|
||||
- rm -rf build
|
||||
- mkdir build
|
||||
services:
|
||||
- docker
|
||||
|
||||
script:
|
||||
- cd build
|
||||
- cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_USE_QT_SYS_PATHS=ON ../sources
|
||||
- make
|
||||
before_install:
|
||||
- docker build --tag="${DOCKER_TAG}" .docker
|
||||
|
||||
scirpt:
|
||||
- docker run "${DOCKER_TAG}" .docker/build.sh
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
#include <QUrl>
|
||||
|
||||
#include <fontdialog/fontdialog.h>
|
||||
|
||||
|
@ -326,16 +326,25 @@ void AWKeys::createDBusInterface()
|
||||
qlonglong id = reinterpret_cast<qlonglong>(this);
|
||||
|
||||
// create session
|
||||
QDBusConnection bus = QDBusConnection::sessionBus();
|
||||
QDBusConnection instanceBus = QDBusConnection::sessionBus();
|
||||
// HACK we are going to use different services because it binds to
|
||||
// application
|
||||
if (!bus.registerService(QString("%1.i%2").arg(AWDBUS_SERVICE).arg(id)))
|
||||
if (instanceBus.registerService(
|
||||
QString("%1.i%2").arg(AWDBUS_SERVICE).arg(id))) {
|
||||
if (!instanceBus.registerObject(AWDBUS_PATH, new AWDBusAdaptor(this),
|
||||
QDBusConnection::ExportAllContents))
|
||||
qCWarning(LOG_AW) << "Could not register DBus object, last error"
|
||||
<< instanceBus.lastError().message();
|
||||
} else {
|
||||
qCWarning(LOG_AW) << "Could not register DBus service, last error"
|
||||
<< bus.lastError().message();
|
||||
if (!bus.registerObject(AWDBUS_PATH, new AWDBusAdaptor(this),
|
||||
QDBusConnection::ExportAllContents))
|
||||
qCWarning(LOG_AW) << "Could not register DBus object, last error"
|
||||
<< bus.lastError().message();
|
||||
<< instanceBus.lastError().message();
|
||||
}
|
||||
|
||||
// and same instance but for id independent service
|
||||
QDBusConnection commonBus = QDBusConnection::sessionBus();
|
||||
if (commonBus.registerService(AWDBUS_SERVICE))
|
||||
commonBus.registerObject(AWDBUS_PATH, new AWDBusAdaptor(this),
|
||||
QDBusConnection::ExportAllContents);
|
||||
}
|
||||
|
||||
|
||||
@ -350,14 +359,8 @@ QString AWKeys::parsePattern(QString _pattern) const
|
||||
|
||||
// main keys
|
||||
for (auto &key : m_foundKeys)
|
||||
_pattern.replace(
|
||||
QString("$%1").arg(key),
|
||||
[this](const QString &tag, const QVariant &value) {
|
||||
QString strValue = m_aggregator->formatter(value, tag);
|
||||
if ((!tag.startsWith("custom")) && (!tag.startsWith("weather")))
|
||||
strValue.replace(" ", " ");
|
||||
return strValue;
|
||||
}(key, m_values[key]));
|
||||
_pattern.replace(QString("$%1").arg(key),
|
||||
m_aggregator->formatter(m_values[key], key));
|
||||
|
||||
// bars
|
||||
for (auto &bar : m_foundBars) {
|
||||
|
@ -186,6 +186,10 @@ QString AWKeysAggregator::formatter(const QVariant &_data,
|
||||
break;
|
||||
}
|
||||
|
||||
// replace spaces to non-breakable ones
|
||||
if (!_key.startsWith("custom") && (!_key.startsWith("weather")))
|
||||
output.replace(" ", " ");
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user