From d783dd243478921031d0f7bca80840429a8b9996 Mon Sep 17 00:00:00 2001 From: Sebastien Braun Date: Wed, 6 Oct 2010 14:55:04 +0200 Subject: Change location of pvsprivinputd.conf to /etc/ Also centralize the knowledge of that location so that it lives in one place only. --- src/input/pvsPrivInputSocket.cpp | 31 +++++++++++++++++++++++++++++-- src/input/pvsPrivInputSocket.h | 5 +++++ 2 files changed, 34 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/input/pvsPrivInputSocket.cpp b/src/input/pvsPrivInputSocket.cpp index 2428582..c491dd9 100644 --- a/src/input/pvsPrivInputSocket.cpp +++ b/src/input/pvsPrivInputSocket.cpp @@ -29,10 +29,37 @@ using namespace std; # define UNIX_PATH_MAX 108 /* according to unix(7) */ #endif +static QSettings* pvsPrivInputSettings = 0; + +QString pvsPrivInputGetSettingsPath() +{ + return "/etc/pvsprivinputd.conf"; +} + +QSettings* pvsPrivInputGetSettings() +{ + if(!pvsPrivInputSettings) + { + pvsPrivInputSettings = new QSettings(pvsPrivInputGetSettingsPath(), QSettings::IniFormat); + } + return pvsPrivInputSettings; +} + +QSettings* pvsPrivInputReopenSettings() +{ + if(pvsPrivInputSettings) + { + delete pvsPrivInputSettings; + pvsPrivInputSettings = 0; + } + return pvsPrivInputGetSettings(); +} + QString pvsPrivInputGetSocketAddress() { - QSettings settings(QSettings::NativeFormat, QSettings::SystemScope, "openslx", "pvsprivinputd"); - return settings.value("socketpath", "/tmp/pvsprivinputd.sock").toString(); + return pvsPrivInputGetSettings()->value("socketpath", "/tmp/pvsprivinputd.sock").toString(); +} + } int pvsPrivInputMakeClientSocket() diff --git a/src/input/pvsPrivInputSocket.h b/src/input/pvsPrivInputSocket.h index e6fb0c0..879ca99 100644 --- a/src/input/pvsPrivInputSocket.h +++ b/src/input/pvsPrivInputSocket.h @@ -22,6 +22,11 @@ #include #include +class QSettings; + +QSettings* pvsPrivInputGetSettings(); +QSettings* pvsPrivInputReopenSettings(); +QString pvsPrivInputGetSettingsPath(); QString pvsPrivInputGetSocketAddress(); int pvsPrivInputMakeClientSocket(); int pvsPrivInputMakeServerSocket(); -- cgit v1.2.3-55-g7522