From 7a49c3ec647a93c50edc2b2744c148333ed75817 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Mon, 6 Jan 2014 02:47:26 +0100 Subject: Finish renaming klirc -> tdelirc --- tdelirc/irkick/CMakeLists.txt | 2 +- tdelirc/irkick/Makefile.am | 6 +- tdelirc/irkick/irkick.h | 2 +- tdelirc/irkick/klircclient.cpp | 241 --------------------------------------- tdelirc/irkick/klircclient.h | 115 ------------------- tdelirc/irkick/tdelircclient.cpp | 241 +++++++++++++++++++++++++++++++++++++++ tdelirc/irkick/tdelircclient.h | 115 +++++++++++++++++++ 7 files changed, 361 insertions(+), 361 deletions(-) delete mode 100644 tdelirc/irkick/klircclient.cpp delete mode 100644 tdelirc/irkick/klircclient.h create mode 100644 tdelirc/irkick/tdelircclient.cpp create mode 100644 tdelirc/irkick/tdelircclient.h (limited to 'tdelirc') diff --git a/tdelirc/irkick/CMakeLists.txt b/tdelirc/irkick/CMakeLists.txt index d8d14d9..415c3b7 100644 --- a/tdelirc/irkick/CMakeLists.txt +++ b/tdelirc/irkick/CMakeLists.txt @@ -30,7 +30,7 @@ link_directories( tde_add_library( irkick_common STATIC_PIC AUTOMOC SOURCES irkick.cpp irkick.skel - irkick.stub klircclient.cpp + irkick.stub tdelircclient.cpp LINK tdeui-shared tdelirc-static ) diff --git a/tdelirc/irkick/Makefile.am b/tdelirc/irkick/Makefile.am index c30b7bb..6e3e0d3 100644 --- a/tdelirc/irkick/Makefile.am +++ b/tdelirc/irkick/Makefile.am @@ -8,7 +8,7 @@ tdeinit_LTLIBRARIES = irkick.la CLEANFILES = dummy.cpp libirkick_common_la_LIBADD = $(LIB_TDECORE) $(LIB_TDEUI) $(LIB_TDESYCOCA) ../tdelirc/libtdelirc.la -libirkick_common_la_SOURCES = main.cpp irkick.cpp irkick.skel irkick.stub klircclient.cpp +libirkick_common_la_SOURCES = main.cpp irkick.cpp irkick.skel irkick.stub tdelircclient.cpp libirkick_common_la_LDFLAGS = $(all_libraries) @@ -30,11 +30,11 @@ dummy.cpp: #kdedservicesdir = $(kde_servicesdir)/kded #kdedservices_DATA = irkick.desktop #lib_LTLIBRARIES = libkded_irkick.la -#libkded_irkick_la_SOURCES = irkick.cpp irkick.skel irkick.stub klircclient.cpp +#libkded_irkick_la_SOURCES = irkick.cpp irkick.skel irkick.stub tdelircclient.cpp #libkded_irkick_la_LDFLAGS = $(all_libraries) -module -avoid-version #libkded_irkick_la_LIBADD = $(LIB_TDECORE) ../tdelirc/libtdelirc.la -noinst_HEADERS = irkick.h klircclient.h irkick_stub.h +noinst_HEADERS = irkick.h tdelircclient.h irkick_stub.h INCLUDES = -I$(srcdir)/../tdelirc $(all_includes) diff --git a/tdelirc/irkick/irkick.h b/tdelirc/irkick/irkick.h index 786e100..cecc26b 100644 --- a/tdelirc/irkick/irkick.h +++ b/tdelirc/irkick/irkick.h @@ -24,7 +24,7 @@ #include "modes.h" #include "iractions.h" -#include "klircclient.h" +#include "tdelircclient.h" class TQMouseEvent; diff --git a/tdelirc/irkick/klircclient.cpp b/tdelirc/irkick/klircclient.cpp deleted file mode 100644 index b7051fc..0000000 --- a/tdelirc/irkick/klircclient.cpp +++ /dev/null @@ -1,241 +0,0 @@ -// -// -// C++ Implementation: $MODULE$ -// -// Description: -// -// -// Author: (C) 2002 by Malte Starostik -// Adaption : Gav Wood , (C) 2003 -// -// Copyright: See COPYING file that comes with this distribution -// -// - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "klircclient.h" - - -KLircClient::KLircClient(TQWidget *parent, const char *name) : TQObject(parent, name), theSocket(0), listIsUpToDate(false) -{ - connectToLirc(); -} - -bool KLircClient::connectToLirc() -{ - int sock = ::socket(PF_UNIX, SOCK_STREAM, 0); - if(sock == -1) return false; - - sockaddr_un addr; - addr.sun_family = AF_UNIX; - strcpy(addr.sun_path, "/dev/lircd"); - if(::connect(sock, (struct sockaddr *)(&addr), sizeof(addr)) == -1) - { ::close(sock); - // in case of mandrake... - strcpy(addr.sun_path, "/tmp/.lircd"); - if(::connect(sock, (struct sockaddr *)(&addr), sizeof(addr)) == -1) - { ::close(sock); - return false; - } - } - - theSocket = new TQSocket; - theSocket->setSocket(sock); - connect(theSocket, TQT_SIGNAL(readyRead()), TQT_SLOT(slotRead())); - connect(theSocket, TQT_SIGNAL(connectionClosed()), TQT_SLOT(slotClosed())); - updateRemotes(); - return true; -} - -KLircClient::~KLircClient() -{ -// if(theSocket) - delete theSocket; -} - -void KLircClient::slotClosed() -{ - delete theSocket; - theSocket = 0; - emit connectionClosed(); -} - -const TQStringList KLircClient::remotes() const -{ - TQStringList remotes; - for(TQMap::ConstIterator i = theRemotes.begin(); i != theRemotes.end(); ++i) - remotes.append(i.key()); - remotes.sort(); - return remotes; -} - -const TQStringList KLircClient::buttons(const TQString &theRemote) const -{ - return theRemotes[theRemote]; -} - -void KLircClient::slotRead() -{ - while (theSocket->bytesAvailable()) - { - TQString line = readLine(); - if (line == "BEGIN") - { - // BEGIN - // - // [SUCCESS|ERROR] - // [DATA - // n - // n lines of data] - // END - line = readLine(); - if (line == "SIGHUP") - { - // Configuration changed - do line = readLine(); - while (!line.isEmpty() && line != "END"); - updateRemotes(); - return; - } - else if (line == "LIST") - { - // remote control list - if (readLine() != "SUCCESS" || readLine() != "DATA") - { - do line = readLine(); - while (!line.isEmpty() && line != "END"); - return; - } - TQStringList remotes; - int count = readLine().toInt(); - for (int i = 0; i < count; ++i) - remotes.append(readLine()); - do line = readLine(); - while (!line.isEmpty() && line != "END"); - if (line.isEmpty()) - return; // abort on corrupt data - for (TQStringList::ConstIterator it = remotes.begin(); it != remotes.end(); ++it) - sendCommand("LIST " + *it); - return; - } - else if (line.left(4) == "LIST") - { - // button list - if (readLine() != "SUCCESS" || readLine() != "DATA") - { - do line = readLine(); - while (!line.isEmpty() && line != "END"); - return; - } - TQString remote = line.mid(5); - TQStringList buttons; - int count = readLine().toInt(); - for (int i = 0; i < count; ++i) - { - // - TQString btn = readLine().mid(17); - if(btn.isNull()) break; - if(btn.startsWith("'") && btn.endsWith("'")) - btn = btn.mid(1, btn.length() - 2); - buttons.append(btn); - } - theRemotes.insert(remote, buttons); - } - do line = readLine(); - while (!line.isEmpty() && line != "END"); - listIsUpToDate = true; - emit remotesRead(); - } - else - { - //