summaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorSebastien Braun2010-10-06 14:55:04 +0200
committerSebastien Braun2010-10-06 14:55:04 +0200
commitd783dd243478921031d0f7bca80840429a8b9996 (patch)
treeb3743489e8b167079f66763746964c36a1ebbdb2 /src/input
parentFix typo that prevents correct compilation when XInput2.h is present (diff)
downloadpvs-d783dd243478921031d0f7bca80840429a8b9996.tar.gz
pvs-d783dd243478921031d0f7bca80840429a8b9996.tar.xz
pvs-d783dd243478921031d0f7bca80840429a8b9996.zip
Change location of pvsprivinputd.conf to /etc/
Also centralize the knowledge of that location so that it lives in one place only.
Diffstat (limited to 'src/input')
-rw-r--r--src/input/pvsPrivInputSocket.cpp31
-rw-r--r--src/input/pvsPrivInputSocket.h5
2 files changed, 34 insertions, 2 deletions
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 <cstring>
#include <QString>
+class QSettings;
+
+QSettings* pvsPrivInputGetSettings();
+QSettings* pvsPrivInputReopenSettings();
+QString pvsPrivInputGetSettingsPath();
QString pvsPrivInputGetSocketAddress();
int pvsPrivInputMakeClientSocket();
int pvsPrivInputMakeServerSocket();