From 359294c33620c8328d61f67635046d7cc060530c Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Fri, 17 May 2013 12:45:40 -0500 Subject: Rename kdessh -> tdessh and kdelirc -> tdelirc. --- tdelirc/kcmlirc/CMakeLists.txt | 47 ++ tdelirc/kcmlirc/Makefile.am | 15 + tdelirc/kcmlirc/addaction.cpp | 375 +++++++++ tdelirc/kcmlirc/addaction.h | 74 ++ tdelirc/kcmlirc/addactionbase.ui | 1608 +++++++++++++++++++++++++++++++++++++ tdelirc/kcmlirc/editaction.cpp | 362 +++++++++ tdelirc/kcmlirc/editaction.h | 56 ++ tdelirc/kcmlirc/editactionbase.ui | 1287 +++++++++++++++++++++++++++++ tdelirc/kcmlirc/editmode.cpp | 38 + tdelirc/kcmlirc/editmode.h | 34 + tdelirc/kcmlirc/editmodebase.ui | 303 +++++++ tdelirc/kcmlirc/kcmlirc.cpp | 545 +++++++++++++ tdelirc/kcmlirc/kcmlirc.desktop | 119 +++ tdelirc/kcmlirc/kcmlirc.h | 85 ++ tdelirc/kcmlirc/kcmlircbase.ui | 506 ++++++++++++ tdelirc/kcmlirc/kcmlircbase.ui.h | 37 + tdelirc/kcmlirc/modeslist.cpp | 33 + tdelirc/kcmlirc/modeslist.h | 34 + tdelirc/kcmlirc/newmode.ui | 158 ++++ tdelirc/kcmlirc/newmode.ui.h | 24 + tdelirc/kcmlirc/selectprofile.ui | 128 +++ 21 files changed, 5868 insertions(+) create mode 100644 tdelirc/kcmlirc/CMakeLists.txt create mode 100644 tdelirc/kcmlirc/Makefile.am create mode 100644 tdelirc/kcmlirc/addaction.cpp create mode 100644 tdelirc/kcmlirc/addaction.h create mode 100644 tdelirc/kcmlirc/addactionbase.ui create mode 100644 tdelirc/kcmlirc/editaction.cpp create mode 100644 tdelirc/kcmlirc/editaction.h create mode 100644 tdelirc/kcmlirc/editactionbase.ui create mode 100644 tdelirc/kcmlirc/editmode.cpp create mode 100644 tdelirc/kcmlirc/editmode.h create mode 100644 tdelirc/kcmlirc/editmodebase.ui create mode 100644 tdelirc/kcmlirc/kcmlirc.cpp create mode 100644 tdelirc/kcmlirc/kcmlirc.desktop create mode 100644 tdelirc/kcmlirc/kcmlirc.h create mode 100644 tdelirc/kcmlirc/kcmlircbase.ui create mode 100644 tdelirc/kcmlirc/kcmlircbase.ui.h create mode 100644 tdelirc/kcmlirc/modeslist.cpp create mode 100644 tdelirc/kcmlirc/modeslist.h create mode 100644 tdelirc/kcmlirc/newmode.ui create mode 100644 tdelirc/kcmlirc/newmode.ui.h create mode 100644 tdelirc/kcmlirc/selectprofile.ui (limited to 'tdelirc/kcmlirc') diff --git a/tdelirc/kcmlirc/CMakeLists.txt b/tdelirc/kcmlirc/CMakeLists.txt new file mode 100644 index 0000000..7761e97 --- /dev/null +++ b/tdelirc/kcmlirc/CMakeLists.txt @@ -0,0 +1,47 @@ +################################################# +# +# (C) 2012 Golubev Alexander +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR}/tdelirc/irkick + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/tdelirc/irkick + ${CMAKE_SOURCE_DIR}/tdelirc/tdelirc + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${CMAKE_BINARY_DIR}/tdelirc/tdelirc +) + + +##### kcm_kcmlirc (kpart) ####################### + +tde_add_kpart( kcm_kcmlirc AUTOMOC + SOURCES selectprofile.ui newmode.ui + kcmlircbase.ui kcmlirc.cpp addactionbase.ui + addaction.cpp kcmlirc.skel editactionbase.ui + editmodebase.ui editmode.cpp editaction.cpp + modeslist.cpp + LINK tdelirc-static tdeui-shared tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### other data ################################ + +install( FILES kcmlirc.desktop + DESTINATION ${XDG_APPS_INSTALL_DIR} +) + diff --git a/tdelirc/kcmlirc/Makefile.am b/tdelirc/kcmlirc/Makefile.am new file mode 100644 index 0000000..53eb7af --- /dev/null +++ b/tdelirc/kcmlirc/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = -I../irkick -I$(srcdir)/../irkick -I$(srcdir)/../tdelirc $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = kcm_kcmlirc.la + +noinst_HEADERS = kcmlirc.h addaction.h addactionbase.h +kcm_kcmlirc_la_SOURCES = selectprofile.ui newmode.ui kcmlircbase.ui kcmlirc.cpp addactionbase.ui addaction.cpp kcmlirc.skel editactionbase.ui editmodebase.ui editmode.cpp editaction.cpp modeslist.cpp +kcm_kcmlirc_la_LIBADD = $(LIB_TDEUI) $(LIB_TDEFILE) ../tdelirc/libtdelirc.la +kcm_kcmlirc_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined + +xdg_apps_DATA = kcmlirc.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/kcmlirc.pot diff --git a/tdelirc/kcmlirc/addaction.cpp b/tdelirc/kcmlirc/addaction.cpp new file mode 100644 index 0000000..8a87775 --- /dev/null +++ b/tdelirc/kcmlirc/addaction.cpp @@ -0,0 +1,375 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "prototype.h" +#include "addaction.h" +#include "profileserver.h" +#include "remoteserver.h" + +AddAction::AddAction(TQWidget *parent, const char *name, const Mode &mode): AddActionBase(parent, name), theMode(mode) +{ + connect(this, TQT_SIGNAL( selected(const TQString &) ), TQT_SLOT( updateForPageChange() )); + connect(this, TQT_SIGNAL( selected(const TQString &) ), TQT_SLOT( slotCorrectPage() )); + curPage = 0; + updateProfiles(); + updateButtons(); + updateObjects(); + updateProfileFunctions(); +} + +AddAction::~AddAction() +{ +} + + +void AddAction::slotNextParam() +{ + // TODO: go on to next parameter +} + +void AddAction::slotModeSelected() +{ + theSwitchMode->setChecked(true); +} + +void AddAction::slotCorrectPage() +{ + int lastPage = curPage; + curPage = indexOf(currentPage()); + + if(curPage == 2 && theUseProfile->isChecked()) + showPage(((TQWizard *)this)->page(lastPage > 1 ? 1 : 3)); + if((curPage == 2 || curPage == 5) && theChangeMode->isChecked()) + showPage(((TQWizard *)this)->page(lastPage > 1 ? 1 : 6)); + + if(curPage == 3 && theUseDCOP->isChecked()) + showPage(((TQWizard *)this)->page(lastPage == 4 ? 2 : 4)); + + if(curPage == 4 && ( + (theUseDCOP->isChecked() && theFunctions->currentItem() && !Prototype(theFunctions->currentItem()->text(2)).count()) || + (theUseProfile->isChecked() && (theProfileFunctions->currentItem() && !theProfileFunctions->currentItem()->text(1).toInt() || theJustStart->isChecked())) + )) + showPage(((TQWizard *)this)->page(lastPage == 5 ? (theUseDCOP->isChecked() ? 2 : 3) : 5)); +} + +void AddAction::requestNextPress() +{ + IRKick_stub("irkick", "IRKick").stealNextPress(DCOPClient::mainClient()->appId(), "KCMLirc", "gotButton(TQString, TQString)"); +} + +void AddAction::cancelRequest() +{ + IRKick_stub("irkick", "IRKick").dontStealNextPress(); +} + +void AddAction::updateButton(const TQString &remote, const TQString &button) +{ + if(theMode.remote() == remote) + { // note this isn't the "correct" way of doing it; really i should iterate throughg the items and try to find the item which when put through buttonMap[item] returns the current button name. but i cant be arsed. + theButtons->setCurrentItem(theButtons->findItem(RemoteServer::remoteServer()->getButtonName(remote, button), 0)); + theButtons->ensureItemVisible(theButtons->findItem(RemoteServer::remoteServer()->getButtonName(remote, button), 0)); + } + else + KMessageBox::error(this, i18n( "You did not select a mode of that remote control. Please use %1, " + "or revert back to select a different mode." ).arg( theMode.remoteName() ), + i18n( "Incorrect Remote Control Detected" )); + + if(indexOf(currentPage()) == 1) + requestNextPress(); +} + +void AddAction::updateButtons() +{ + theButtons->clear(); + buttonMap.clear(); + IRKick_stub IRKick("irkick", "IRKick"); + TQStringList buttons = IRKick.buttons(theMode.remote()); + for(TQStringList::iterator j = buttons.begin(); j != buttons.end(); ++j) + buttonMap[new TQListViewItem(theButtons, RemoteServer::remoteServer()->getButtonName(theMode.remote(), *j))] = *j; +} + +void AddAction::updateForPageChange() +{ + if(indexOf(currentPage()) == 1) requestNextPress(); else cancelRequest(); + switch(indexOf(currentPage())) + { case 0: break; + case 1: break; + case 2: break; + case 3: break; + case 4: break; + } + updateButtonStates(); +} + +void AddAction::updateButtonStates() +{ + switch(indexOf(currentPage())) + { case 0: setNextEnabled(currentPage(), theProfiles->currentItem() != 0 || !theUseProfile->isChecked()); break; + case 1: setNextEnabled(currentPage(), theButtons->currentItem() != 0); break; + case 2: setNextEnabled(currentPage(), theFunctions->currentItem() != 0); break; + case 3: setNextEnabled(currentPage(), theProfileFunctions->currentItem() != 0 || theJustStart->isChecked()); break; + case 4: setNextEnabled(currentPage(), true); break; + case 5: setNextEnabled(currentPage(), false); setFinishEnabled(currentPage(), true); break; + case 6: setNextEnabled(currentPage(), false); setFinishEnabled(currentPage(), theModes->currentItem() || !theSwitchMode->isChecked()); break; + } +} + +const TQStringList AddAction::getFunctions(const TQString app, const TQString obj) +{ + TQStringList ret; + DCOPClient *theClient = TDEApplication::kApplication()->dcopClient(); + QCStringList theApps = theClient->remoteFunctions(app.utf8(), obj.utf8()); + for(QCStringList::iterator i = theApps.begin(); i != theApps.end(); ++i) + if( *i != "QCStringList interfaces()" && + *i != "QCStringList functions()" && + *i != "QCStringList objects()" && + *i != "QCStringList find(TQCString)" ) + ret += TQString::fromUtf8(*i); + return ret; +} + +void AddAction::updateProfiles() +{ + ProfileServer *theServer = ProfileServer::profileServer(); + theProfiles->clear(); + profileMap.clear(); + + TQDict dict = theServer->profiles(); + TQDictIterator i(dict); + for(; i.current(); ++i) + profileMap[new TQListViewItem(theProfiles, i.current()->name())] = i.currentKey(); +} + +void AddAction::updateOptions() +{ + IfMulti im; + if(theUseProfile->isChecked()) + { + ProfileServer *theServer = ProfileServer::profileServer(); + if(!theProfiles->currentItem()) return; + const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]]; + im = p->ifMulti(); + isUnique = p->unique(); + } + else if(theUseDCOP->isChecked()) + { + if(!theObjects->selectedItem()) return; + TQListViewItem* i = theObjects->selectedItem()->parent(); + if(!i) return; + isUnique = uniqueProgramMap[i]; + TQRegExp r("(.*)-[0-9]+"); + program = r.exactMatch(nameProgramMap[i]) ? r.cap(1) : nameProgramMap[i]; + im = IM_DONTSEND; + } + else return; + + theIMLabel->setEnabled(!isUnique); + theIMGroup->setEnabled(!isUnique); + theIMLine->setEnabled(!isUnique); + theIMTop->setEnabled(!isUnique); + theDontSend->setEnabled(!isUnique); + theSendToBottom->setEnabled(!isUnique); + theSendToTop->setEnabled(!isUnique); + theSendToAll->setEnabled(!isUnique); + switch(im) + { case IM_DONTSEND: theDontSend->setChecked(true); break; + case IM_SENDTOTOP: theSendToTop->setChecked(true); break; + case IM_SENDTOBOTTOM: theSendToBottom->setChecked(true); break; + case IM_SENDTOALL: theSendToAll->setChecked(true); break; + } +} + +void AddAction::updateProfileFunctions() +{ + ProfileServer *theServer = ProfileServer::profileServer(); + theProfileFunctions->clear(); + profileFunctionMap.clear(); + if(!theProfiles->currentItem()) return; + + const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]]; + TQDict dict = p->actions(); + for(TQDictIterator i(dict); i.current(); ++i) + profileFunctionMap[new TQListViewItem(theProfileFunctions, i.current()->name(), TQString().setNum(i.current()->arguments().count()), i.current()->comment())] = i.currentKey(); + updateParameters(); + updateOptions(); +} + +void AddAction::updateParameters() +{ + theParameters->clear(); + theArguments.clear(); + if(theUseDCOP->isChecked() && theFunctions->currentItem()) + { + Prototype p(theFunctions->currentItem()->text(2)); + for(unsigned k = 0; k < p.count(); k++) + { new TDEListViewItem(theParameters, p.name(k).isEmpty() ? i18n( "" ) : p.name(k), "", p.type(k), TQString().setNum(k + 1)); + theArguments.append(TQVariant("")); + theArguments.back().cast(TQVariant::nameToType(p.type(k).utf8())); + } + } + else if(theUseProfile->isChecked() && theProfiles->currentItem()) + { + ProfileServer *theServer = ProfileServer::profileServer(); + + if(!theProfiles->currentItem()) return; + if(!theProfileFunctions->currentItem()) return; + const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]]; + const ProfileAction *pa = p->actions()[profileFunctionMap[theProfileFunctions->currentItem()]]; + + int index = 1; + for(TQValueList::const_iterator i = pa->arguments().begin(); i != pa->arguments().end(); ++i, index++) + { theArguments.append(TQVariant((*i).getDefault())); + theArguments.back().cast(TQVariant::nameToType((*i).type().utf8())); + new TQListViewItem(theParameters, (*i).comment(), theArguments.back().toString(), (*i).type(), TQString().setNum(index)); + } + + // quicky update options too... + theRepeat->setChecked(pa->repeat()); + theAutoStart->setChecked(pa->autoStart()); + } + + updateParameter(); +} + +void AddAction::updateParameter() +{ + if(theParameters->currentItem()) + { TQString type = theParameters->currentItem()->text(2); + int index = theParameters->currentItem()->text(3).toInt() - 1; + if(type.find("int") != -1 || type.find("short") != -1 || type.find("long") != -1) + { theValue->raiseWidget(2); + theValueIntNumInput->setValue(theArguments[index].toInt()); + } + else if(type.find("double") != -1 || type.find("float") != -1) + { theValue->raiseWidget(3); + theValueDoubleNumInput->setValue(theArguments[index].toDouble()); + } + else if(type.find("bool") != -1) + { theValue->raiseWidget(1); + theValueCheckBox->setChecked(theArguments[index].toBool()); + } + else if(type.find(TQSTRINGLIST_OBJECT_NAME_STRING) != -1) + { theValue->raiseWidget(4); + TQStringList backup = theArguments[index].toStringList(); + // backup needed because calling clear will kill what ever has been saved. + theValueEditListBox->clear(); + theValueEditListBox->insertStringList(backup); + theArguments[index].asStringList() = backup; + } + else + { theValue->raiseWidget(0); + theValueLineEdit->setText(theArguments[index].toString()); + } + theCurParameter->setText(theParameters->currentItem()->text(0)); + theCurParameter->setEnabled(true); + theValue->setEnabled(true); + } + else + { theCurParameter->setText(""); + theValueLineEdit->setText(""); + theValueCheckBox->setChecked(false); + theValueIntNumInput->setValue(0); + theValueDoubleNumInput->setValue(0.0); + theCurParameter->setEnabled(false); + theValue->setEnabled(false); + } +} + +// called when the textbox/checkbox/whatever changes value +void AddAction::slotParameterChanged() +{ + if(!theParameters->currentItem()) return; + int index = theParameters->currentItem()->text(3).toInt() - 1; + TQString type = theParameters->currentItem()->text(2); + if(type.find("int") != -1 || type.find("short") != -1 || type.find("long") != -1) + theArguments[index].asInt() = theValueIntNumInput->value(); + else if(type.find("double") != -1 || type.find("float") != -1) + theArguments[index].asDouble() = theValueDoubleNumInput->value(); + else if(type.find("bool") != -1) + theArguments[index].asBool() = theValueCheckBox->isChecked(); + else if(type.find(TQSTRINGLIST_OBJECT_NAME_STRING) != -1) + theArguments[index].asStringList() = theValueEditListBox->items(); + else + theArguments[index].asString() = theValueLineEdit->text(); + + theArguments[theParameters->currentItem()->text(3).toInt() - 1].cast(TQVariant::nameToType(theParameters->currentItem()->text(2).utf8())); + updateArgument(theParameters->currentItem()); +} + +// takes theArguments[theIndex] and puts it into theItem +void AddAction::updateArgument(TQListViewItem *theItem) +{ + theItem->setText(1, theArguments[theItem->text(3).toInt() - 1].toString()); +} + +void AddAction::updateObjects() +{ + TQStringList names; + theObjects->clear(); + uniqueProgramMap.clear(); + nameProgramMap.clear(); + + DCOPClient *theClient = TDEApplication::kApplication()->dcopClient(); + QCStringList theApps = theClient->registeredApplications(); + for(QCStringList::iterator i = theApps.begin(); i != theApps.end(); ++i) + { + if(!TQString(*i).find("anonymous")) continue; + if(!TQString(*i).find(i18n( "anonymous" ))) continue; + TQRegExp r("(.*)-[0-9]+"); + TQString name = r.exactMatch(TQString(*i)) ? r.cap(1) : *i; + if(names.contains(name)) continue; + names += name; + + TDEListViewItem *a = new TDEListViewItem(theObjects, name); + uniqueProgramMap[a] = name == TQString(*i); + nameProgramMap[a] = *i; + + QCStringList theObjects = theClient->remoteObjects(*i); + for(QCStringList::iterator j = theObjects.begin(); j != theObjects.end(); ++j) + if(*j != "tdesycoca" && *j != "qt")// && getFunctions(*i, *j).count()) + new TDEListViewItem(a, *j); + } + updateFunctions(); +} + +void AddAction::updateFunctions() +{ + theFunctions->clear(); + if(theObjects->currentItem() && theObjects->currentItem()->parent()) + { TQStringList functions = getFunctions(nameProgramMap[theObjects->currentItem()->parent()], theObjects->currentItem()->text(0)); + for(TQStringList::iterator i = functions.begin(); i != functions.end(); ++i) + { Prototype p((TQString)(*i)); + new TDEListViewItem(theFunctions, p.name(), p.argumentList(), *i); + } + } + updateOptions(); +} + + +#include "addaction.moc" diff --git a/tdelirc/kcmlirc/addaction.h b/tdelirc/kcmlirc/addaction.h new file mode 100644 index 0000000..3a3f22f --- /dev/null +++ b/tdelirc/kcmlirc/addaction.h @@ -0,0 +1,74 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#ifndef ADDACTION_H +#define ADDACTION_H + +#include +#include + +#include + +#include "mode.h" +#include "arguments.h" + +/** +@author Gav Wood +*/ + +class TQListViewItem; + +class AddAction : public AddActionBase +{ + Q_OBJECT + + + int curPage; + Mode theMode; + +public slots: + virtual void slotCorrectPage(); + virtual void slotModeSelected(); + virtual void slotNextParam(); + virtual void slotParameterChanged(); + + // connected to KCMLirc class to receive DCOP calls to tell it what button has been pressed + virtual void updateForPageChange(); + virtual void updateButton(const TQString &remote, const TQString &button); + virtual void updateButtons(); + virtual void updateFunctions(); + virtual void updateObjects(); + virtual void updateButtonStates(); + virtual void updateParameters(); + virtual void updateParameter(); + virtual void updateProfiles(); + virtual void updateProfileFunctions(); + virtual void updateOptions(); + +public: + Arguments theArguments; + TQString program; + bool isUnique; + + static const TQStringList getFunctions(const TQString app, const TQString obj); + void updateArgument(TQListViewItem *theItem); + void requestNextPress(); + void cancelRequest(); + + TQMap profileMap; + TQMap profileFunctionMap; + TQMap buttonMap; + TQMap uniqueProgramMap; + TQMap nameProgramMap; + + AddAction(TQWidget *parent, const char *name, const Mode &mode); + ~AddAction(); +}; + +#endif diff --git a/tdelirc/kcmlirc/addactionbase.ui b/tdelirc/kcmlirc/addactionbase.ui new file mode 100644 index 0000000..dfb6f12 --- /dev/null +++ b/tdelirc/kcmlirc/addactionbase.ui @@ -0,0 +1,1608 @@ + +AddActionBase +Gav Wood + + + AddActionBase + + + + 0 + 0 + 723 + 593 + + + + Add Action + + + + page + + + Select Action to Carry Out on Button Press + + + + unnamed + + + + buttonGroup1 + + + + 5 + 5 + 0 + 1 + + + + NoFrame + + + + + + + unnamed + + + 0 + + + + theUseProfile + + + I wish to select an &application below for usage: + + + true + + + + + layout14 + + + + unnamed + + + + spacer13 + + + Horizontal + + + Expanding + + + + 81 + 31 + + + + + + + Applications + + + true + + + true + + + + theProfiles + + + + 7 + 7 + 3 + 0 + + + + true + + + + + spacer14 + + + Horizontal + + + Expanding + + + + 101 + 31 + + + + + + + + spacer11 + + + Horizontal + + + Expanding + + + + 311 + 20 + + + + + + theUseDCOP + + + I wish to manually select a &function from a running program + + + + + spacer12 + + + Horizontal + + + Expanding + + + + 321 + 21 + + + + + + theChangeMode + + + I wish to change the remote control's &mode + + + + + spacer4 + + + Vertical + + + Expanding + + + + 21 + 20 + + + + + + + + + + page + + + Select Button to Configure + + + + unnamed + + + + theButtonText + + + You are attempting to configure an action for a button on [remote] (in mode [mode]). Press a button on this remote control or select from the list. + + + WordBreak|AlignVCenter + + + + + layout6 + + + + unnamed + + + + spacer12_2 + + + Horizontal + + + Expanding + + + + 110 + 41 + + + + + + + Button + + + true + + + true + + + + theButtons + + + + 7 + 7 + 2 + 0 + + + + true + + + + + spacer5 + + + Horizontal + + + Expanding + + + + 110 + 31 + + + + + + + + + + page + + + Select Program Function + + + + unnamed + + + + splitter8 + + + Horizontal + + + + + Program + + + true + + + true + + + + + IR Kick + + + + + + + + Xine + + + + + + + + kicker + + + + + + + kicker + + + + + + + + + noatun + + + + + + + Marquis + + + + + + + + Noatun + + + + + + + + noatun + + + + + + + + theObjects + + + + 7 + 7 + 0 + 1 + + + + true + + + false + + + + + layout13 + + + + unnamed + + + 0 + + + + + Function + + + true + + + true + + + + + Parameter + + + true + + + true + + + + + Prototype + + + true + + + true + + + + theFunctions + + + + 3 + 7 + 0 + 0 + + + + + + + + + + + page + + + Select Program Function + + + + unnamed + + + + buttonGroup4 + + + NoFrame + + + + + + + unnamed + + + + theNotJustStart + + + &Perform a function in the application: + + + true + + + + + layout37 + + + + unnamed + + + + spacer39 + + + Horizontal + + + Expanding + + + + 61 + 21 + + + + + + + Function + + + true + + + true + + + + + Options + + + true + + + true + + + + + Description + + + true + + + true + + + + theProfileFunctions + + + + 7 + 7 + 7 + 0 + + + + true + + + + + + + theJustStart + + + &Just start the application. Do not do anything else. + + + + + spacer40 + + + Vertical + + + Expanding + + + + 21 + 81 + + + + + + + + + + page + + + Populate Parameters + + + + unnamed + + + + + Option Description + + + true + + + true + + + + + Value + + + true + + + true + + + + + Type + + + true + + + true + + + + + Place + + + true + + + true + + + + theParameters + + + + + layout35 + + + + unnamed + + + + layout34 + + + + unnamed + + + + spacer32 + + + Vertical + + + Expanding + + + + 21 + 111 + + + + + + theCurParameter + + + false + + + + 3 + 5 + 0 + 0 + + + + Parameter: + + + + + + + spacer27 + + + Horizontal + + + Expanding + + + + 146 + 21 + + + + + + theValue + + + true + + + + 7 + 5 + 0 + 0 + + + + + page + + + 0 + + + + unnamed + + + 0 + + + + spacer28 + + + Vertical + + + Expanding + + + + 21 + 61 + + + + + + theValueLineEdit + + + true + + + + + + + page + + + 1 + + + + unnamed + + + 0 + + + + spacer29 + + + Vertical + + + Expanding + + + + 21 + 61 + + + + + + theValueCheckBox + + + true + + + + + + + + + + page + + + 2 + + + + unnamed + + + 0 + + + + spacer30 + + + Vertical + + + Expanding + + + + 20 + 61 + + + + + + theValueIntNumInput + + + + + + + page + + + 3 + + + + unnamed + + + 0 + + + + spacer31 + + + Vertical + + + Expanding + + + + 21 + 51 + + + + + + theValueDoubleNumInput + + + + + + + page + + + 4 + + + + unnamed + + + 0 + + + + theValueEditListBox + + + + + + + + + + + spacer26 + + + Horizontal + + + Expanding + + + + 147 + 21 + + + + + + + + + + page + + + Finishing Up + + + + unnamed + + + + textLabel1 + + + + 1 + + + + Miscellaneous Options + + + + + line1_2 + + + HLine + + + Sunken + + + Horizontal + + + + + theRepeat + + + This action is &repeatable if the button is held down + + + + + theAutoStart + + + This action causes the application to &start if not already running + + + true + + + + + spacer22 + + + Horizontal + + + Expanding + + + + 670 + 20 + + + + + + theIMTop + + + false + + + + 1 + + + + Multiple Instances + + + + + theIMLine + + + false + + + HLine + + + Sunken + + + Horizontal + + + + + theIMLabel + + + false + + + This application may have multiple instances. In the case of having multiple instances at once when this action should be executed, choose a course of action: + + + WordBreak|AlignVCenter + + + + + theIMGroup + + + false + + + NoFrame + + + 0 + + + + + + + unnamed + + + 0 + + + + theDontSend + + + false + + + &Ignore the action + + + true + + + + + theSendToTop + + + false + + + Send the action to the instance hi&ghest in the window stacking order + + + + + theSendToBottom + + + false + + + Send the action to the instance &lowest in window stacking order + + + + + theSendToAll + + + false + + + Send the action to &all instances + + + + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 170 + + + + + + + + page + + + Select Required Mode Change + + + + unnamed + + + + buttonGroup3 + + + NoFrame + + + + + + + unnamed + + + 0 + + + + theSwitchMode + + + &Switch to mode: + + + + + layout13 + + + + unnamed + + + + spacer8 + + + Horizontal + + + Expanding + + + + 131 + 31 + + + + + + + Mode + + + true + + + true + + + + theModes + + + + 7 + 7 + 3 + 0 + + + + true + + + + + spacer9 + + + Horizontal + + + Expanding + + + + 131 + 31 + + + + + + + + theExitMode + + + &Exit current mode + + + true + + + + + spacer15_2 + + + Horizontal + + + Expanding + + + + 551 + 20 + + + + + + textLabel1_2 + + + <b>Options</b> + + + + + line2 + + + HLine + + + Sunken + + + Horizontal + + + + + theDoBefore + + + E&xecute all other actions before mode change (in original mode) + + + true + + + + + theDoAfter + + + Exec&ute all actions after mode change (in new mode) + + + + + spacer10 + + + Vertical + + + Expanding + + + + 21 + 30 + + + + + + + + + + + + + theObjects + currentChanged(TQListViewItem*) + AddActionBase + updateFunctions() + + + theParameters + currentChanged(TQListViewItem*) + AddActionBase + updateParameter() + + + theFunctions + currentChanged(TQListViewItem*) + AddActionBase + updateButtonStates() + + + theSwitchMode + stateChanged(int) + AddActionBase + updateButtonStates() + + + theExitMode + stateChanged(int) + AddActionBase + updateButtonStates() + + + theChangeMode + stateChanged(int) + AddActionBase + updateButtonStates() + + + theUseDCOP + stateChanged(int) + AddActionBase + updateButtonStates() + + + theUseProfile + stateChanged(int) + AddActionBase + updateButtonStates() + + + theProfiles + currentChanged(TQListViewItem*) + AddActionBase + updateButtonStates() + + + theModes + currentChanged(TQListViewItem*) + AddActionBase + updateButtonStates() + + + theModes + clicked(TQListViewItem*) + AddActionBase + slotModeSelected() + + + theUseProfile + toggled(bool) + theProfiles + setEnabled(bool) + + + theValueDoubleNumInput + valueChanged(double) + AddActionBase + slotParameterChanged() + + + theValueIntNumInput + valueChanged(int) + AddActionBase + slotParameterChanged() + + + theValueLineEdit + textChanged(const TQString&) + AddActionBase + slotParameterChanged() + + + theValueCheckBox + toggled(bool) + AddActionBase + slotParameterChanged() + + + theProfileFunctions + currentChanged(TQListViewItem*) + AddActionBase + updateParameters() + + + theFunctions + currentChanged(TQListViewItem*) + AddActionBase + updateParameters() + + + theProfiles + currentChanged(TQListViewItem*) + AddActionBase + updateProfileFunctions() + + + theValueEditListBox + changed() + AddActionBase + slotParameterChanged() + + + theNotJustStart + toggled(bool) + theProfileFunctions + setEnabled(bool) + + + theNotJustStart + toggled(bool) + theAutoStart + setEnabled(bool) + + + theJustStart + toggled(bool) + theAutoStart + setChecked(bool) + + + theNotJustStart + toggled(bool) + theRepeat + setEnabled(bool) + + + theNotJustStart + toggled(bool) + theRepeat + setChecked(bool) + + + theProfileFunctions + currentChanged(TQListViewItem*) + AddActionBase + updateOptions() + + + theFunctions + currentChanged(TQListViewItem*) + AddActionBase + updateOptions() + + + theProfiles + doubleClicked(TQListViewItem*) + AddActionBase + next() + + + theButtons + doubleClicked(TQListViewItem*) + AddActionBase + next() + + + theFunctions + doubleClicked(TQListViewItem*) + AddActionBase + next() + + + theProfileFunctions + doubleClicked(TQListViewItem*) + AddActionBase + next() + + + theModes + doubleClicked(TQListViewItem*) + AddActionBase + accept() + + + + updateFunctions() + updateParameter() + updateParameters() + updateButtonStates() + updateCurrentParam(const TQString &) + slotNextParam() + slotCorrectPage() + slotModeSelected() + updateProfileFunctions() + updateForPageChange() + slotParameterChanged() + updateOptions() + + + + tdelistview.h + tdelistview.h + tdelistview.h + tdelistview.h + tdelistview.h + tdelistview.h + klineedit.h + knuminput.h + knuminput.h + knuminput.h + knuminput.h + keditlistbox.h + klineedit.h + tdelistview.h + + diff --git a/tdelirc/kcmlirc/editaction.cpp b/tdelirc/kcmlirc/editaction.cpp new file mode 100644 index 0000000..8d8a0cb --- /dev/null +++ b/tdelirc/kcmlirc/editaction.cpp @@ -0,0 +1,362 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: 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 "prototype.h" +#include "profileserver.h" +#include "remoteserver.h" +#include "editaction.h" +#include "addaction.h" + +EditAction::EditAction(IRAIt action, TQWidget *parent, const char *name) : EditActionBase(parent, name) +{ + theAction = action; + + updateApplications(); + updateDCOPApplications(); +} + +EditAction::~EditAction() +{ +} + +void EditAction::readFrom() +{ + theRepeat->setChecked((*theAction).repeat()); + theAutoStart->setChecked((*theAction).autoStart()); + theDoBefore->setChecked((*theAction).doBefore()); + theDoAfter->setChecked((*theAction).doAfter()); + theDontSend->setChecked((*theAction).ifMulti() == IM_DONTSEND); + theSendToTop->setChecked((*theAction).ifMulti() == IM_SENDTOTOP); + theSendToBottom->setChecked((*theAction).ifMulti() == IM_SENDTOBOTTOM); + theSendToAll->setChecked((*theAction).ifMulti() == IM_SENDTOALL); + + if((*theAction).isModeChange()) + { // change mode + theChangeMode->setChecked(true); + if((*theAction).object().isEmpty()) + theModes->setCurrentText(i18n("[Exit current mode]")); + else + theModes->setCurrentText((*theAction).object()); + } + else if((*theAction).isJustStart()) + { // profile action + theUseProfile->setChecked(true); + const Profile *p = ProfileServer::profileServer()->profiles()[(*theAction).program()]; + theApplications->setCurrentText(p->name()); + updateFunctions(); + updateArguments(); + theJustStart->setChecked(true); + } + else if(ProfileServer::profileServer()->getAction((*theAction).program(), (*theAction).object(), (*theAction).method().prototype())) + { // profile action + theUseProfile->setChecked(true); + const ProfileAction *a = ProfileServer::profileServer()->getAction((*theAction).program(), (*theAction).object(), (*theAction).method().prototype()); + theApplications->setCurrentText(a->profile()->name()); + updateFunctions(); + theFunctions->setCurrentText(a->name()); + arguments = (*theAction).arguments(); + updateArguments(); + theNotJustStart->setChecked(true); + } + else + { // dcop action + theUseDCOP->setChecked(true); + theDCOPApplications->setCurrentText((*theAction).program()); + updateDCOPObjects(); + theDCOPObjects->setCurrentText((*theAction).object()); + updateDCOPFunctions(); + theDCOPFunctions->setCurrentText((*theAction).method().prototype()); + arguments = (*theAction).arguments(); + updateArguments(); + } + updateOptions(); +} + +void EditAction::writeBack() +{ + if(theChangeMode->isChecked()) + { + (*theAction).setProgram(""); + if(theModes->currentText() == i18n("[Exit current mode]")) + (*theAction).setObject(""); + else + (*theAction).setObject(theModes->currentText()); + (*theAction).setDoBefore(theDoBefore->isChecked()); + (*theAction).setDoAfter(theDoAfter->isChecked()); + } + else if(theUseProfile->isChecked() && ( + ProfileServer::profileServer()->getAction(applicationMap[theApplications->currentText()], functionMap[theFunctions->currentText()]) + || + theJustStart->isChecked() && ProfileServer::profileServer()->profiles()[theApplications->currentText()] + ) + ) + { if(theJustStart->isChecked()) + { (*theAction).setProgram(ProfileServer::profileServer()->profiles()[applicationMap[theApplications->currentText()]]->id()); + (*theAction).setObject(""); + } + else + { const ProfileAction *a = ProfileServer::profileServer()->getAction(applicationMap[theApplications->currentText()], functionMap[theFunctions->currentText()]); + (*theAction).setProgram(ProfileServer::profileServer()->profiles()[applicationMap[theApplications->currentText()]]->id()); + (*theAction).setObject(a->objId()); + (*theAction).setMethod(a->prototype()); + (*theAction).setArguments(arguments); + } + } + else + { + (*theAction).setProgram(program);//theDCOPApplications->currentText()); + (*theAction).setObject(theDCOPObjects->currentText()); + (*theAction).setMethod(theDCOPFunctions->currentText()); + (*theAction).setArguments(arguments); + } + (*theAction).setRepeat(theRepeat->isChecked()); + (*theAction).setAutoStart(theAutoStart->isChecked()); + (*theAction).setUnique(isUnique); + (*theAction).setIfMulti(theDontSend->isChecked() ? IM_DONTSEND : theSendToTop->isChecked() ? IM_SENDTOTOP : theSendToBottom->isChecked() ? IM_SENDTOBOTTOM : IM_SENDTOALL); +} + +void EditAction::updateArguments() +{ + kdDebug() << k_funcinfo << endl; + if(theUseProfile->isChecked()) + { + theArguments->clear(); + const ProfileAction *a = ProfileServer::profileServer()->getAction(applicationMap[theApplications->currentText()], functionMap[theFunctions->currentText()]); + if(!a) { arguments.clear(); return; } + const TQValueList &p = a->arguments(); + if(p.count() != arguments.count()) + { arguments.clear(); + for(unsigned i = 0; i < p.count(); i++) + arguments.append(TQVariant("")); + } + theArguments->setEnabled(p.count()); + for(unsigned i = 0; i < p.count(); i++) + { theArguments->insertItem(p[i].comment() + " (" + p[i].type() + ")"); + arguments[i].cast(TQVariant::nameToType(p[i].type().utf8())); + } + if(p.count()) updateArgument(0); else updateArgument(-1); + } + else if(theUseDCOP->isChecked()) + { + theArguments->clear(); + Prototype p(theDCOPFunctions->currentText()); + if(p.count() != arguments.count()) + { arguments.clear(); + for(unsigned i = 0; i < p.count(); i++) + arguments.append(TQVariant("")); + } + theArguments->setEnabled(p.count()); + for(unsigned i = 0; i < p.count(); i++) + { theArguments->insertItem(TQString(TQString().setNum(i + 1) + ": " + (p.name(i).isEmpty() ? p.type(i) : p.name(i) + " (" + p.type(i) + ")"))); + arguments[i].cast(TQVariant::nameToType(p.type(i).utf8())); + } + if(p.count()) updateArgument(0); else updateArgument(-1); + } +} + +void EditAction::updateOptions() +{ + if (theUseProfile->isChecked()) + { + ProfileServer *theServer = ProfileServer::profileServer(); + if(!theApplications->currentItem()) return; + const Profile *p = theServer->profiles()[applicationMap[theApplications->currentText()]]; + isUnique = p->unique(); + } + else if (theUseDCOP->isChecked()) + { + if(theDCOPApplications->currentText().isNull() || theDCOPApplications->currentText().isEmpty()) return; + program = theDCOPApplications->currentText(); + isUnique = uniqueProgramMap[theDCOPApplications->currentText()]; + } + else + isUnique = true; + + theIMLabel->setEnabled(!isUnique); + theIMGroup->setEnabled(!isUnique); + theDontSend->setEnabled(!isUnique); + theSendToTop->setEnabled(!isUnique); + theSendToBottom->setEnabled(!isUnique); + theSendToAll->setEnabled(!isUnique); +} + +// called when the textbox/checkbox/whatever changes value +void EditAction::slotParameterChanged() +{ + kdDebug() << "in: " << arguments[theArguments->currentItem()].toString() << endl; + int type = arguments[theArguments->currentItem()].type(); + kdDebug() << type << endl; + switch(type) + { + case TQVariant::Int: case TQVariant::UInt: + arguments[theArguments->currentItem()].asInt() = theValueIntNumInput->value(); + break; + case TQVariant::Double: + arguments[theArguments->currentItem()].asDouble() = theValueDoubleNumInput->value(); + break; + case TQVariant::Bool: + arguments[theArguments->currentItem()].asBool() = theValueCheckBox->isChecked(); + break; + case TQVariant::StringList: + arguments[theArguments->currentItem()].asStringList() = theValueEditListBox->items(); + break; + default: + arguments[theArguments->currentItem()].asString() = theValueLineEdit->text(); + } + arguments[theArguments->currentItem()].cast(TQVariant::Type(type)); + kdDebug() << "out: " << arguments[theArguments->currentItem()].toString() << endl; + +} + +void EditAction::updateArgument(int index) +{ + kdDebug() << k_funcinfo << " i: " << index << endl; + if(index >= 0) + { switch(arguments[index].type()) + { + case TQVariant::Int: case TQVariant::UInt: + theValue->raiseWidget(2); + theValueIntNumInput->setValue(arguments[index].toInt()); + break; + case TQVariant::Double: + theValue->raiseWidget(3); + theValueDoubleNumInput->setValue(arguments[index].toDouble()); + break; + case TQVariant::Bool: + theValue->raiseWidget(1); + theValueCheckBox->setChecked(arguments[index].toBool()); + break; + case TQVariant::StringList: + { theValue->raiseWidget(4); + TQStringList backup = arguments[index].toStringList(); + // backup needed because calling clear will kill what ever has been saved. + theValueEditListBox->clear(); + theValueEditListBox->insertStringList(backup); + arguments[index].asStringList() = backup; + break; + } + default: + theValue->raiseWidget(0); + theValueLineEdit->setText(arguments[index].toString()); + } + theValue->setEnabled(true); + } + else + { theValueLineEdit->setText(""); + theValueCheckBox->setChecked(false); + theValueIntNumInput->setValue(0); + theValueDoubleNumInput->setValue(0.0); + theValue->setEnabled(false); + } +} + +void EditAction::updateApplications() +{ + ProfileServer *theServer = ProfileServer::profileServer(); + theApplications->clear(); + applicationMap.clear(); + + TQDict dict = theServer->profiles(); + TQDictIterator i(dict); + for(; i.current(); ++i) + { theApplications->insertItem(i.current()->name()); + applicationMap[i.current()->name()] = i.currentKey(); + } + updateFunctions(); +} + +void EditAction::updateFunctions() +{ + ProfileServer *theServer = ProfileServer::profileServer(); + theFunctions->clear(); + functionMap.clear(); + if(theApplications->currentText().isNull() || theApplications->currentText().isEmpty()) return; + + const Profile *p = theServer->profiles()[applicationMap[theApplications->currentText()]]; + + TQDict dict = p->actions(); + for(TQDictIterator i(dict); i.current(); ++i) + { theFunctions->insertItem(i.current()->name()); + functionMap[i.current()->name()] = i.currentKey(); + } + updateArguments(); +} + +void EditAction::updateDCOPApplications() +{ + TQStringList names; + + theDCOPApplications->clear(); + DCOPClient *theClient = TDEApplication::kApplication()->dcopClient(); + QCStringList theApps = theClient->registeredApplications(); + for(QCStringList::iterator i = theApps.begin(); i != theApps.end(); ++i) + { + if(!TQString(*i).find("anonymous")) continue; + TQRegExp r("(.*)-[0-9]+"); + TQString name = r.exactMatch(TQString(*i)) ? r.cap(1) : *i; + if(names.contains(name)) continue; + names += name; + + theDCOPApplications->insertItem(name); + uniqueProgramMap[name] = name == TQString(*i); + nameProgramMap[name] = *i; + + + } + updateDCOPObjects(); +} + +void EditAction::updateDCOPObjects() +{ + theDCOPObjects->clear(); + DCOPClient *theClient = TDEApplication::kApplication()->dcopClient(); + if(theDCOPApplications->currentText().isNull() || theDCOPApplications->currentText().isEmpty()) return; + QCStringList theObjects = theClient->remoteObjects(nameProgramMap[theDCOPApplications->currentText()].utf8()); + if(!theObjects.size() && theDCOPApplications->currentText() == (*theAction).program()) theDCOPObjects->insertItem((*theAction).object()); + for(QCStringList::iterator j = theObjects.begin(); j != theObjects.end(); ++j) + if(*j != "tdesycoca" && *j != "qt" && AddAction::getFunctions(nameProgramMap[theDCOPApplications->currentText()], *j).count()) + theDCOPObjects->insertItem(TQString::fromUtf8(*j)); + updateDCOPFunctions(); +} + +void EditAction::updateDCOPFunctions() +{ + theDCOPFunctions->clear(); + if(theDCOPApplications->currentText().isNull() || theDCOPApplications->currentText().isEmpty()) return; + TQStringList functions = AddAction::getFunctions(nameProgramMap[theDCOPApplications->currentText()], theDCOPObjects->currentText()); + if(!functions.size() && theDCOPApplications->currentText() == (*theAction).program()) theDCOPFunctions->insertItem((*theAction).method().prototype()); + for(TQStringList::iterator i = functions.begin(); i != functions.end(); ++i) + theDCOPFunctions->insertItem(*i); + updateArguments(); +} + + +#include "editaction.moc" diff --git a/tdelirc/kcmlirc/editaction.h b/tdelirc/kcmlirc/editaction.h new file mode 100644 index 0000000..8b19b6a --- /dev/null +++ b/tdelirc/kcmlirc/editaction.h @@ -0,0 +1,56 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood , (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef EDITACTION_H +#define EDITACTION_H + +#include + +#include "iractions.h" +#include "editactionbase.h" +#include "arguments.h" + +/** +@author Gav Wood +*/ + +class EditAction : public EditActionBase +{ + Q_OBJECT + + IRAIt theAction; + TQMap applicationMap, functionMap; + TQMap nameProgramMap; + TQMap uniqueProgramMap; + Arguments arguments; + TQString program; + bool isUnique; + +public: + void writeBack(); + void readFrom(); + + virtual void slotParameterChanged(); + virtual void updateArgument(int index); + virtual void updateArguments(); + virtual void updateApplications(); + virtual void updateFunctions(); + virtual void updateOptions(); + virtual void updateDCOPApplications(); + virtual void updateDCOPObjects(); + virtual void updateDCOPFunctions(); + + EditAction(IRAIt action, TQWidget *parent = 0, const char *name = 0); + ~EditAction(); +}; + +#endif diff --git a/tdelirc/kcmlirc/editactionbase.ui b/tdelirc/kcmlirc/editactionbase.ui new file mode 100644 index 0000000..7e1a006 --- /dev/null +++ b/tdelirc/kcmlirc/editactionbase.ui @@ -0,0 +1,1287 @@ + +EditActionBase + + + EditActionBase + + + + 0 + 0 + 754 + 715 + + + + Edit Action + + + true + + + + unnamed + + + + tabWidget3 + + + + tab + + + Function + + + + unnamed + + + + buttonGroup3 + + + NoFrame + + + + + + + unnamed + + + 0 + + + + layout40 + + + + unnamed + + + + theDCOPApplications + + + false + + + + 5 + 0 + 0 + 0 + + + + + + textLabel4_3 + + + false + + + O&bject: + + + theDCOPObjects + + + + + buttonGroup5 + + + NoFrame + + + + + + + unnamed + + + 0 + + + + theNotJustStart + + + + 3 + 0 + 0 + 0 + + + + &Perform function: + + + true + + + + + theFunctions + + + + 3 + 0 + 0 + 0 + + + + + + theJustStart + + + Just start application + + + + + + + textLabel4_2 + + + false + + + Fu&nction: + + + theDCOPFunctions + + + + + textLabel5 + + + &Application: + + + theApplications + + + + + theApplications + + + + 5 + 0 + 0 + 0 + + + + + + theDCOPFunctions + + + false + + + + + theUseProfile + + + &Use application: + + + true + + + + + textLabel5_2 + + + false + + + App&lication: + + + theDCOPApplications + + + + + theUseDCOP + + + Use &DCOP: + + + + + theDCOPObjects + + + false + + + + + + + layout36 + + + + unnamed + + + + theValue + + + true + + + + 7 + 5 + 0 + 0 + + + + + page + + + 0 + + + + unnamed + + + 0 + + + + theValueLineEdit + + + true + + + + + spacer35 + + + Vertical + + + Expanding + + + + 20 + 91 + + + + + + + + page + + + 1 + + + + unnamed + + + 0 + + + + theValueCheckBox + + + true + + + + + + + + spacer36 + + + Vertical + + + Expanding + + + + 20 + 101 + + + + + + + + page + + + 2 + + + + unnamed + + + 0 + + + + theValueIntNumInput + + + + + spacer37 + + + Vertical + + + Expanding + + + + 21 + 101 + + + + + + + + page + + + 3 + + + + unnamed + + + 0 + + + + theValueDoubleNumInput + + + + + spacer38 + + + Vertical + + + Expanding + + + + 20 + 101 + + + + + + + + page + + + 4 + + + + unnamed + + + 0 + + + + theValueEditListBox + + + + 3 + 3 + 0 + 0 + + + + + + + + + + + + spacer33 + + + Vertical + + + Expanding + + + + 21 + 111 + + + + + + theArguments + + + + 3 + 0 + 0 + 0 + + + + + 106 + 0 + + + + + + spacer34 + + + Vertical + + + Expanding + + + + 20 + 101 + + + + + + textLabel8 + + + A&pplication/DCOP options: + + + theArguments + + + + + + + spacer14 + + + Horizontal + + + Expanding + + + + 481 + 20 + + + + + + layout17 + + + + unnamed + + + + theChangeMode + + + Change &mode to: + + + + + theModes + + + false + + + + 7 + 0 + 0 + 0 + + + + + + + + spacer15 + + + Vertical + + + Expanding + + + + 21 + 30 + + + + + + + + + + tab + + + Options + + + + unnamed + + + + textLabel3 + + + <b>DCOP/Application Action Options</b> + + + + + line2 + + + HLine + + + Sunken + + + Horizontal + + + + + theRepeat + + + &Action repeats if button is held down + + + + + theAutoStart + + + &Start program/service if not already running + + + + + spacer20 + + + Horizontal + + + Expanding + + + + 491 + 20 + + + + + + textLabel1_2 + + + <b>Mode Change Options</b> + + + + + line2_2 + + + HLine + + + Sunken + + + Horizontal + + + + + theDoBefore + + + false + + + E&xecute all other actions before mode change (in original mode) + + + true + + + + + theDoAfter + + + false + + + Exec&ute all actions after mode change (in new mode) + + + + + spacer22 + + + Horizontal + + + Expanding + + + + 670 + 20 + + + + + + theIMTop + + + true + + + + 1 + + + + Multiple Instances + + + + + theIMLine + + + true + + + HLine + + + Sunken + + + Horizontal + + + + + theIMLabel + + + false + + + This application may have multiple instances. In the case of having multiple instances at once when this action should be executed, choose a course of action: + + + WordBreak|AlignVCenter + + + + + theIMGroup + + + false + + + NoFrame + + + 0 + + + + + + + unnamed + + + 0 + + + + theDontSend + + + false + + + &Ignore the action + + + true + + + + + theSendToTop + + + false + + + Send the action to the instance hi&ghest in window stacking order + + + + + theSendToBottom + + + false + + + Send the action to the instance &lowest in window stacking order + + + + + theSendToAll + + + false + + + Send the action to all i&nstances + + + + + + + spacer3 + + + Vertical + + + Expanding + + + + 20 + 150 + + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + F1 + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + true + + + + + + + + + + + buttonOk + clicked() + EditActionBase + accept() + + + buttonCancel + clicked() + EditActionBase + reject() + + + theUseProfile + toggled(bool) + theApplications + setEnabled(bool) + + + theUseProfile + toggled(bool) + theFunctions + setEnabled(bool) + + + theUseDCOP + toggled(bool) + theDCOPApplications + setEnabled(bool) + + + theUseDCOP + toggled(bool) + theDCOPObjects + setEnabled(bool) + + + theUseDCOP + toggled(bool) + theDCOPFunctions + setEnabled(bool) + + + theChangeMode + toggled(bool) + theModes + setEnabled(bool) + + + theApplications + activated(const TQString&) + EditActionBase + updateFunctions() + + + theDCOPApplications + activated(const TQString&) + EditActionBase + updateDCOPObjects() + + + theDCOPObjects + activated(const TQString&) + EditActionBase + updateDCOPFunctions() + + + theFunctions + activated(const TQString&) + EditActionBase + updateArguments() + + + theDCOPFunctions + activated(const TQString&) + EditActionBase + updateArguments() + + + theUseProfile + toggled(bool) + theArguments + setEnabled(bool) + + + theUseDCOP + toggled(bool) + theArguments + setEnabled(bool) + + + theArguments + activated(int) + EditActionBase + updateArgument(int) + + + theUseProfile + clicked() + EditActionBase + updateArguments() + + + theUseDCOP + clicked() + EditActionBase + updateArguments() + + + theUseProfile + toggled(bool) + theAutoStart + setEnabled(bool) + + + theUseDCOP + toggled(bool) + theAutoStart + setEnabled(bool) + + + theUseProfile + toggled(bool) + theRepeat + setEnabled(bool) + + + theUseDCOP + toggled(bool) + theRepeat + setEnabled(bool) + + + theChangeMode + toggled(bool) + theDoAfter + setEnabled(bool) + + + theChangeMode + toggled(bool) + theDoBefore + setEnabled(bool) + + + theValueDoubleNumInput + valueChanged(double) + EditActionBase + slotParameterChanged() + + + theValueLineEdit + textChanged(const TQString&) + EditActionBase + slotParameterChanged() + + + theValueCheckBox + toggled(bool) + EditActionBase + slotParameterChanged() + + + theValueIntNumInput + valueChanged(int) + EditActionBase + slotParameterChanged() + + + theValueEditListBox + changed() + EditActionBase + slotParameterChanged() + + + theNotJustStart + toggled(bool) + theFunctions + setEnabled(bool) + + + theJustStart + toggled(bool) + theAutoStart + setChecked(bool) + + + theNotJustStart + toggled(bool) + theRepeat + setChecked(bool) + + + theNotJustStart + toggled(bool) + theAutoStart + setEnabled(bool) + + + theNotJustStart + toggled(bool) + theRepeat + setEnabled(bool) + + + theNotJustStart + toggled(bool) + theArguments + setEnabled(bool) + + + theNotJustStart + toggled(bool) + theValue + setEnabled(bool) + + + theUseProfile + toggled(bool) + theNotJustStart + setEnabled(bool) + + + theUseProfile + toggled(bool) + theJustStart + setEnabled(bool) + + + theUseProfile + toggled(bool) + theNotJustStart + setChecked(bool) + + + theDCOPApplications + activated(const TQString&) + EditActionBase + updateOptions() + + + theApplications + activated(const TQString&) + EditActionBase + updateOptions() + + + theUseProfile + toggled(bool) + EditActionBase + updateOptions() + + + theUseDCOP + toggled(bool) + EditActionBase + updateOptions() + + + theChangeMode + toggled(bool) + EditActionBase + updateOptions() + + + theJustStart + toggled(bool) + EditActionBase + updateOptions() + + + theNotJustStart + toggled(bool) + EditActionBase + updateOptions() + + + theUseProfile + toggled(bool) + textLabel5 + setEnabled(bool) + + + theUseDCOP + toggled(bool) + textLabel5_2 + setEnabled(bool) + + + theUseDCOP + toggled(bool) + textLabel4_3 + setEnabled(bool) + + + theUseDCOP + toggled(bool) + textLabel4_2 + setEnabled(bool) + + + theChangeMode + toggled(bool) + textLabel8 + setDisabled(bool) + + + + tabWidget3 + theUseProfile + theApplications + theFunctions + theDCOPApplications + theDCOPObjects + theDCOPFunctions + theModes + theRepeat + theAutoStart + buttonHelp + buttonOk + buttonCancel + + + updateFunctions() + updateApplications() + updateDCOPApplications() + updateDCOPObjects() + updateDCOPFunctions() + updateArguments() + updateArgument(int) + slotParameterChanged() + updateOptions() + + + + klineedit.h + knuminput.h + knuminput.h + knuminput.h + knuminput.h + keditlistbox.h + klineedit.h + + diff --git a/tdelirc/kcmlirc/editmode.cpp b/tdelirc/kcmlirc/editmode.cpp new file mode 100644 index 0000000..a197bb7 --- /dev/null +++ b/tdelirc/kcmlirc/editmode.cpp @@ -0,0 +1,38 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood , (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include +#include +#include + +#include "editmode.h" + +EditMode::EditMode(TQWidget *parent, const char *name, bool modal, WFlags fl) : EditModeBase(parent, name, modal, fl) +{ + theIcon->setIconType(TDEIcon::Panel, TDEIcon::Any); +} + +EditMode::~EditMode() +{ +} + +void EditMode::slotClearIcon() +{ + theIcon->resetIcon(); +} + +void EditMode::slotCheckText(const TQString &newText) +{ + theOK->setEnabled(!newText.isEmpty()); +} + +#include "editmode.moc" diff --git a/tdelirc/kcmlirc/editmode.h b/tdelirc/kcmlirc/editmode.h new file mode 100644 index 0000000..5de0836 --- /dev/null +++ b/tdelirc/kcmlirc/editmode.h @@ -0,0 +1,34 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood , (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef EDITMODE_H +#define EDITMODE_H + +#include "editmodebase.h" + +/** +@author Gav Wood +*/ +class EditMode : public EditModeBase +{ + Q_OBJECT + + +public: + void slotCheckText(const TQString &newText); + void slotClearIcon(); + + EditMode(TQWidget *parent = 0, const char *name = 0, bool modal = false, WFlags fl = 0); + ~EditMode(); +}; + +#endif diff --git a/tdelirc/kcmlirc/editmodebase.ui b/tdelirc/kcmlirc/editmodebase.ui new file mode 100644 index 0000000..b59533b --- /dev/null +++ b/tdelirc/kcmlirc/editmodebase.ui @@ -0,0 +1,303 @@ + +EditModeBase + + + EditModeBase + + + + 0 + 0 + 461 + 334 + + + + Edit Mode + + + + unnamed + + + + textLabel1 + + + <b>Description</b> + + + + + line3_2 + + + HLine + + + Sunken + + + Horizontal + + + + + layout25 + + + + unnamed + + + + textLabel4 + + + &Icon for system tray: + + + theIcon + + + + + layout24 + + + + unnamed + + + + spacer11 + + + Horizontal + + + Expanding + + + + 110 + 21 + + + + + + theIcon + + + + 5 + 5 + 0 + 0 + + + + + + + + + kPushButton9 + + + + + + image0 + + + + + + + theName + + + false + + + + + textLabel5 + + + &Mode name: + + + theName + + + + + + + spacer4 + + + Horizontal + + + Expanding + + + + 410 + 20 + + + + + + textLabel2 + + + <b>Behavior</b> + + + + + line2 + + + HLine + + + Sunken + + + Horizontal + + + + + theDefault + + + Mo&de is the default for its remote control + + + + + spacer9 + + + Vertical + + + Expanding + + + + 20 + 90 + + + + + + line3 + + + HLine + + + Sunken + + + Horizontal + + + + + layout15 + + + + unnamed + + + + spacer10 + + + Horizontal + + + Expanding + + + + 231 + 20 + + + + + + theOK + + + &OK + + + + + kPushButton8 + + + &Cancel + + + + + + + + + 789c7dd0cd4e84301405e03d4fd17077c438201421c647d0b834312efa03c31d0648745c18e3bbcbb905fc8d0768fa1d202dec12757f77a3925df47c322776ca75e64925fe65185e1f1eafdfa2382b15ce4b95c567517cae9cba9dc606739ae7944ac009cc2a1ce008e6599ee6f2e20016599116c223a88df6da803d589ab22e851d58d9aaae2c7800eba2d67501ee856ea6033d680b5b5ab9db08fd4c0fba8526d02e6c020de8b46d9c065bd06b7fe1850cb612f9f61fd93afaccdad1ef8ec858e74de36cbb7644fb8eb93b60583aa2be3f32b35ca1231ae68c8c8cc3d24d129aab791a3a0ecbc973dbbabc5414cab02e4bb70ecbfef88f3d7f2bb7efe52df4ef7ff9dabd5f451f45248a2d + + + + + theName + textChanged(const TQString&) + EditModeBase + slotCheckText(const TQString&) + + + theOK + clicked() + EditModeBase + accept() + + + kPushButton8 + clicked() + EditModeBase + reject() + + + kPushButton9 + clicked() + EditModeBase + slotClearIcon() + + + + slotCheckText(const TQString &) + slotClearIcon() + + + + kicondialog.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + + diff --git a/tdelirc/kcmlirc/kcmlirc.cpp b/tdelirc/kcmlirc/kcmlirc.cpp new file mode 100644 index 0000000..bf18895 --- /dev/null +++ b/tdelirc/kcmlirc/kcmlirc.cpp @@ -0,0 +1,545 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#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 "addaction.h" +#include "newmode.h" +#include "profileserver.h" +#include "remoteserver.h" +#include "kcmlirc.h" +#include "editaction.h" +#include "editmode.h" +#include "modeslist.h" +#include "selectprofile.h" + +typedef KGenericFactory theFactory; +K_EXPORT_COMPONENT_FACTORY(kcmlirc, theFactory("kcmlirc")) + +KCMLirc::KCMLirc(TQWidget *parent, const char *name, TQStringList /*args*/) : DCOPObject("KCMLirc"), TDECModule(parent, name) +{ + TDEGlobal::locale()->insertCatalogue( "kcmlirc" ); + setAboutData(new TDEAboutData("kcmlirc", I18N_NOOP("TDE Lirc"), VERSION, I18N_NOOP("The TDE IR Remote Control System"), TDEAboutData::License_GPL_V2, "Copyright (c)2003 Gav Wood", I18N_NOOP("Use this to configure TDE's infrared remote control system in order to control any TDE application with your infrared remote control."), "http://www.kde.org")); + setButtons(TDECModule::Help); + setQuickHelp(i18n("

Remote Controls

This module allows you to configure bindings between your remote controls and TDE applications. Simply select your remote control and click Add under the Actions/Buttons list. If you want TDE to attempt to automatically assign buttons to a supported application's actions, try clicking the Auto-Populate button.

To view the recognised applications and remote controls, simply select the Loaded Extensions tab.

")); + bool ok; + TDEApplication::kApplication()->dcopClient()->remoteInterfaces("irkick", "IRKick", &ok); + if(!ok) + if(KMessageBox::questionYesNo(this, i18n("The Infrared Remote Control software is not currently running. This configuration module will not work properly without it. Would you like to start it now?"), i18n("Software Not Running"), i18n("Start"), i18n("Do Not Start")) == KMessageBox::Yes) + { kdDebug() << "S" << TDEApplication::startServiceByDesktopName("irkick") << endl; + KSimpleConfig theConfig("irkickrc"); + theConfig.setGroup("General"); + if(theConfig.readBoolEntry("AutoStart", true) == false) + if(KMessageBox::questionYesNo(this, i18n("Would you like the infrared remote control software to start automatically when you begin TDE?"), i18n("Automatically Start?"), i18n("Start Automatically"), i18n("Do Not Start")) == KMessageBox::Yes) + theConfig.writeEntry("AutoStart", true); + } + + TDEApplication::kApplication()->dcopClient()->remoteInterfaces("irkick", "IRKick", &ok); + kdDebug() << "OK" << ok << endl; + + + (new TQHBoxLayout(this))->setAutoAdd(true); + theKCMLircBase = new KCMLircBase(this); + connect(theKCMLircBase->theModes, TQT_SIGNAL( selectionChanged(TQListViewItem *) ), this, TQT_SLOT( updateActions() )); + connect(theKCMLircBase->theModes, TQT_SIGNAL( selectionChanged(TQListViewItem *) ), this, TQT_SLOT( updateModesStatus(TQListViewItem *) )); + connect(theKCMLircBase->theActions, TQT_SIGNAL( currentChanged(TQListViewItem *) ), this, TQT_SLOT( updateActionsStatus(TQListViewItem *) )); + connect(theKCMLircBase->theExtensions, TQT_SIGNAL( selectionChanged(TQListViewItem *) ), this, TQT_SLOT( updateInformation() )); + connect(theKCMLircBase->theModes, TQT_SIGNAL( itemRenamed(TQListViewItem *) ), this, TQT_SLOT( slotRenamed(TQListViewItem *) )); + connect(theKCMLircBase->theModes, TQT_SIGNAL(dropped(TDEListView*, TQDropEvent*, TQListViewItem*, TQListViewItem*)), this, TQT_SLOT(slotDrop(TDEListView*, TQDropEvent*, TQListViewItem*, TQListViewItem*))); + connect((TQObject *)(theKCMLircBase->theAddActions), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotAddActions() )); + connect((TQObject *)(theKCMLircBase->theAddAction), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotAddAction() )); + connect((TQObject *)(theKCMLircBase->theEditAction), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotEditAction() )); + connect((TQObject *)(theKCMLircBase->theActions), TQT_SIGNAL( doubleClicked(TQListViewItem *) ), this, TQT_SLOT( slotEditAction() )); + connect((TQObject *)(theKCMLircBase->theRemoveAction), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotRemoveAction() )); + connect((TQObject *)(theKCMLircBase->theAddMode), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotAddMode() )); + connect((TQObject *)(theKCMLircBase->theEditMode), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotEditMode() )); + connect((TQObject *)(theKCMLircBase->theRemoveMode), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotRemoveMode() )); + load(); +} + +KCMLirc::~KCMLirc() +{ +} + +void KCMLirc::updateModesStatus(TQListViewItem *item) +{ + theKCMLircBase->theModes->setItemsRenameable(item && item->parent()); + theKCMLircBase->theAddActions->setEnabled(ProfileServer::profileServer()->profiles().count() && theKCMLircBase->theModes->selectedItem() && RemoteServer::remoteServer()->remotes()[modeMap[theKCMLircBase->theModes->selectedItem()].remote()]); + theKCMLircBase->theAddAction->setEnabled(item); + theKCMLircBase->theAddMode->setEnabled(item); + theKCMLircBase->theRemoveMode->setEnabled(item && item->parent()); + theKCMLircBase->theEditMode->setEnabled(item); +} + +void KCMLirc::updateActionsStatus(TQListViewItem *item) +{ + theKCMLircBase->theRemoveAction->setEnabled(item); + theKCMLircBase->theEditAction->setEnabled(item); +} + +void KCMLirc::slotRenamed(TQListViewItem *item) +{ + if(!item) return; + + if(item->parent() && item->text(0) != modeMap[item].name()) + { allActions.renameMode(modeMap[item], item->text(0)); + allModes.rename(modeMap[item], item->text(0)); + emit changed(true); + updateModes(); + } +} + +void KCMLirc::slotEditAction() +{ + if(!theKCMLircBase->theActions->currentItem()) return; + + EditAction theDialog(actionMap[theKCMLircBase->theActions->currentItem()], this); + TQListViewItem *item = theKCMLircBase->theModes->currentItem(); + if(item->parent()) item = item->parent(); + theDialog.theModes->insertItem(i18n("[Exit current mode]")); + for(item = item->firstChild(); item; item = item->nextSibling()) + theDialog.theModes->insertItem(item->text(0)); + theDialog.readFrom(); + if(theDialog.exec() == TQDialog::Accepted) { theDialog.writeBack(); emit changed(true); updateActions(); } +} + +void KCMLirc::slotAddActions() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + Mode m = modeMap[theKCMLircBase->theModes->selectedItem()]; + if(!RemoteServer::remoteServer()->remotes()[m.remote()]) return; + + SelectProfile theDialog(this, 0); + + TQMap profileMap; + TQDict dict = ProfileServer::profileServer()->profiles(); + for(TQDictIterator i(dict); i.current(); ++i) profileMap[new TQListViewItem(theDialog.theProfiles, i.current()->name())] = i.current(); + + if(theDialog.exec() == TQDialog::Accepted && theDialog.theProfiles->currentItem()) + { autoPopulate(*(profileMap[theDialog.theProfiles->currentItem()]), *(RemoteServer::remoteServer()->remotes()[m.remote()]), m.name()); + updateActions(); + emit changed(true); + } +} + +void KCMLirc::slotAddAction() +{ + kdDebug() << k_funcinfo << endl; + if(!theKCMLircBase->theModes->selectedItem()) return; + Mode m = modeMap[theKCMLircBase->theModes->selectedItem()]; + + AddAction theDialog(this, 0, m); + connect(this, TQT_SIGNAL(haveButton(const TQString &, const TQString &)), &theDialog, TQT_SLOT(updateButton(const TQString &, const TQString &))); + + // populate the modes list box + TQListViewItem *item = theKCMLircBase->theModes->selectedItem(); + if(item->parent()) item = item->parent(); + theDialog.theModes->setEnabled(item->firstChild()); + theDialog.theSwitchMode->setEnabled(item->firstChild()); + for(item = item->firstChild(); item; item = item->nextSibling()) + { TDEListViewItem *a = new TDEListViewItem(theDialog.theModes, item->text(0)); + if(item->isSelected()) { a->setSelected(true); theDialog.theModes->setCurrentItem(a); } + } + + if(theDialog.exec() == TQDialog::Accepted && theDialog.theButtons->selectedItem()) + { IRAction a; + a.setRemote(m.remote()); + a.setMode(m.name()); + a.setButton(theDialog.buttonMap[theDialog.theButtons->selectedItem()]); + a.setRepeat(theDialog.theRepeat->isChecked()); + a.setAutoStart(theDialog.theAutoStart->isChecked()); + a.setDoBefore(theDialog.theDoBefore->isChecked()); + a.setDoAfter(theDialog.theDoAfter->isChecked()); + a.setUnique(theDialog.isUnique); + a.setIfMulti(theDialog.theDontSend->isChecked() ? IM_DONTSEND : theDialog.theSendToTop->isChecked() ? IM_SENDTOTOP : theDialog.theSendToBottom->isChecked() ? IM_SENDTOBOTTOM : IM_SENDTOALL); + // change mode? + if(theDialog.theChangeMode->isChecked()) + { + if(theDialog.theSwitchMode->isChecked() && theDialog.theModes->selectedItem()) + { + a.setProgram(""); + a.setObject(theDialog.theModes->selectedItem()->text(0)); + } + else if(theDialog.theExitMode->isChecked()) + { + a.setProgram(""); + a.setObject(""); + } + a.setAutoStart(false); + a.setRepeat(false); + } + // DCOP? + else if(theDialog.theUseDCOP->isChecked() && theDialog.theObjects->selectedItem() && theDialog.theObjects->selectedItem()->parent() && theDialog.theFunctions->selectedItem()) + { + a.setProgram(theDialog.program); + a.setObject(theDialog.theObjects->selectedItem()->text(0)); + a.setMethod(theDialog.theFunctions->selectedItem()->text(2)); + theDialog.theParameters->setSorting(3); + a.setArguments(theDialog.theArguments); + } + // profile? + else if(theDialog.theUseProfile->isChecked() && theDialog.theProfiles->selectedItem() && (theDialog.theProfileFunctions->selectedItem() || theDialog.theJustStart->isChecked())) + { + ProfileServer *theServer = ProfileServer::profileServer(); + + if(theDialog.theNotJustStart->isChecked()) + { const ProfileAction *theAction = theServer->getAction(theDialog.profileMap[theDialog.theProfiles->selectedItem()], theDialog.profileFunctionMap[theDialog.theProfileFunctions->selectedItem()]); + a.setProgram(theAction->profile()->id()); + a.setObject(theAction->objId()); + a.setMethod(theAction->prototype()); + theDialog.theParameters->setSorting(3); + a.setArguments(theDialog.theArguments); + } + else + { a.setProgram(theServer->profiles()[theDialog.profileMap[theDialog.theProfiles->selectedItem()]]->id()); + a.setObject(""); + } + } + + // save our new action + allActions.addAction(a); + updateActions(); + emit changed(true); + } +} + +void KCMLirc::slotRemoveAction() +{ + if(!theKCMLircBase->theActions->currentItem()) return; + + IRAIt i = actionMap[theKCMLircBase->theActions->currentItem()]; + allActions.erase(i); + updateActions(); + emit changed(true); +} + +void KCMLirc::autoPopulate(const Profile &profile, const Remote &remote, const TQString &mode) +{ + TQDict d = remote.buttons(); + for(TQDictIterator i(d); i.current(); ++i) + { const ProfileAction *pa = profile.searchClass(i.current()->getClass()); + if(pa) + { + IRAction a; + a.setRemote(remote.id()); + a.setMode(mode); + a.setButton(i.current()->id()); + a.setRepeat(pa->repeat()); + a.setAutoStart(pa->autoStart()); + a.setProgram(pa->profile()->id()); + a.setObject(pa->objId()); + a.setMethod(pa->prototype()); + a.setUnique(pa->profile()->unique()); + a.setIfMulti(pa->profile()->ifMulti()); + Arguments l; + // argument count should be either 0 or 1. undefined if > 1. + if(Prototype(pa->prototype()).argumentCount() == 1) + { + l.append(TQString(TQString().setNum(i.current()->parameter().toFloat() * pa->multiplier()))); + l.back().cast(TQVariant::nameToType(Prototype(pa->prototype()).type(0).utf8())); + } + a.setArguments(l); + allActions.addAction(a); + } + } +} + +void KCMLirc::slotAddMode() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + + NewMode theDialog(this, 0); + TQMap remoteMap; + TQListViewItem *tr = theKCMLircBase->theModes->selectedItem(); + if(tr) if(tr->parent()) tr = tr->parent(); + for(TQListViewItem *i = theKCMLircBase->theModes->firstChild(); i; i = i->nextSibling()) + { TDEListViewItem *a = new TDEListViewItem(theDialog.theRemotes, i->text(0)); + remoteMap[a] = modeMap[i].remote(); + if(i == tr) { a->setSelected(true); theDialog.theRemotes->setCurrentItem(a); } + } + if(theDialog.exec() == TQDialog::Accepted && theDialog.theRemotes->selectedItem() && !theDialog.theName->text().isEmpty()) + { + allModes.add(Mode(remoteMap[theDialog.theRemotes->selectedItem()], theDialog.theName->text())); + updateModes(); + emit changed(true); + } +} + +void KCMLirc::slotEditMode() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + + EditMode theDialog(this, 0); + + Mode &mode = modeMap[theKCMLircBase->theModes->selectedItem()]; + theDialog.theName->setEnabled(theKCMLircBase->theModes->selectedItem()->parent()); + theDialog.theName->setText(mode.name().isEmpty() ? mode.remoteName() : mode.name()); + if(!mode.iconFile().isNull()) + theDialog.theIcon->setIcon(mode.iconFile()); + else + theDialog.theIcon->resetIcon(); + theDialog.theDefault->setChecked(allModes.isDefault(mode)); + theDialog.theDefault->setEnabled(!allModes.isDefault(mode)); + + if(theDialog.exec() == TQDialog::Accepted) + { kdDebug() << "Setting icon : " << theDialog.theIcon->icon() << endl; + mode.setIconFile(theDialog.theIcon->icon().isEmpty() ? TQString() : theDialog.theIcon->icon()); + allModes.updateMode(mode); + if(!mode.name().isEmpty()) + { allActions.renameMode(mode, theDialog.theName->text()); + allModes.rename(mode, theDialog.theName->text()); + } + if(theDialog.theDefault->isChecked()) allModes.setDefault(mode); + emit changed(true); + updateModes(); + } +} + +void KCMLirc::slotRemoveMode() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + if(!theKCMLircBase->theModes->selectedItem()->parent()) return; + + if(KMessageBox::warningContinueCancel(this, i18n("Are you sure you want to remove %1 and all its actions?").arg(theKCMLircBase->theModes->selectedItem()->text(0)), i18n("Erase Actions?")) == KMessageBox::Continue) + { + allModes.erase(modeMap[theKCMLircBase->theModes->selectedItem()]); + updateModes(); + emit changed(true); + } +} + +void KCMLirc::slotSetDefaultMode() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + allModes.setDefault(modeMap[theKCMLircBase->theModes->selectedItem()]); + updateModes(); + emit changed(true); +} + +void KCMLirc::slotDrop(TDEListView *, TQDropEvent *, TQListViewItem *, TQListViewItem *after) +{ + Mode m = modeMap[after]; + + if(modeMap[theKCMLircBase->theModes->selectedItem()].remote() != m.remote()) + { + KMessageBox::error(this, i18n("You may only drag the selected items onto a mode of the same remote control"), i18n("You May Not Drag Here")); + return; + } + for(TQListViewItem *i = theKCMLircBase->theActions->firstChild(); i; i = i->nextSibling()) + if(i->isSelected()) + (*(actionMap[i])).setMode(m.name()); + + updateActions(); + emit changed(true); +} + +void KCMLirc::updateActions() +{ + IRAIt oldCurrent; + if(theKCMLircBase->theActions->selectedItem()) oldCurrent = actionMap[theKCMLircBase->theActions->selectedItem()]; + + theKCMLircBase->theActions->clear(); + actionMap.clear(); + + if(!theKCMLircBase->theModes->selectedItem()) { updateActionsStatus(0); return; } + + Mode m = modeMap[theKCMLircBase->theModes->selectedItem()]; + theKCMLircBase->theModeLabel->setText(m.remoteName() + ": " + (m.name().isEmpty() ? i18n("Actions always available") : i18n("Actions available only in mode %1").arg(m.name()))); + IRAItList l = allActions.findByMode(m); + for(IRAItList::iterator i = l.begin(); i != l.end(); ++i) + { TQListViewItem *b = new TDEListViewItem(theKCMLircBase->theActions, (**i).buttonName(), (**i).application(), (**i).function(), (**i).arguments().toString(), (**i).notes()); + actionMap[b] = *i; + if(*i == oldCurrent) { b->setSelected(true); theKCMLircBase->theActions->setCurrentItem(b); } + } + + if(theKCMLircBase->theActions->currentItem()) + theKCMLircBase->theActions->currentItem()->setSelected(true); + updateActionsStatus(theKCMLircBase->theActions->currentItem()); +} + +void KCMLirc::gotButton(TQString remote, TQString button) +{ + emit haveButton(remote, button); +} + +void KCMLirc::updateModes() +{ + Mode oldCurrent; + if(theKCMLircBase->theModes->selectedItem()) oldCurrent = modeMap[theKCMLircBase->theModes->selectedItem()]; + + theKCMLircBase->theModes->clear(); + modeMap.clear(); + + IRKick_stub IRKick("irkick", "IRKick"); + TQStringList remotes = IRKick.remotes(); + if(remotes.begin() == remotes.end()) + theKCMLircBase->theMainLabel->setMaximumSize(32767, 32767); + else + theKCMLircBase->theMainLabel->setMaximumSize(0, 0); + for(TQStringList::iterator i = remotes.begin(); i != remotes.end(); ++i) + { Mode mode = allModes.getMode(*i, ""); + TQListViewItem *a = new TDEListViewItem(theKCMLircBase->theModes, RemoteServer::remoteServer()->getRemoteName(*i), allModes.isDefault(mode) ? "Default" : "", mode.iconFile().isNull() ? "" : ""); + if(!mode.iconFile().isNull()) + a->setPixmap(2, TDEIconLoader().loadIcon(mode.iconFile(), TDEIcon::Panel)); + modeMap[a] = mode; // the null mode + if(modeMap[a] == oldCurrent) { a->setSelected(true); theKCMLircBase->theModes->setCurrentItem(a); } + a->setOpen(true); + ModeList l = allModes.getModes(*i); + for(ModeList::iterator j = l.begin(); j != l.end(); ++j) + if(!(*j).name().isEmpty()) + { TQListViewItem *b = new TDEListViewItem(a, (*j).name(), allModes.isDefault(*j) ? i18n("Default") : "", (*j).iconFile().isNull() ? "" : ""); + if(!(*j).iconFile().isNull()) + b->setPixmap(2, TDEIconLoader().loadIcon((*j).iconFile(), TDEIcon::Panel)); + modeMap[b] = *j; + if(*j == oldCurrent) { b->setSelected(true); theKCMLircBase->theModes->setCurrentItem(b); } + } + } + if(theKCMLircBase->theModes->currentItem()) + theKCMLircBase->theModes->currentItem()->setSelected(true); + updateModesStatus(theKCMLircBase->theModes->currentItem()); + updateActions(); +} + +void KCMLirc::updateExtensions() +{ + theKCMLircBase->theExtensions->clear(); + + { ProfileServer *theServer = ProfileServer::profileServer(); + TQListViewItem *a = new TQListViewItem(theKCMLircBase->theExtensions, i18n("Applications")); + a->setOpen(true); + profileMap.clear(); + TQDict dict = theServer->profiles(); + TQDictIterator i(dict); + for(; i.current(); ++i) + profileMap[new TQListViewItem(a, i.current()->name())] = i.currentKey(); + } + { RemoteServer *theServer = RemoteServer::remoteServer(); + TQListViewItem *a = new TQListViewItem(theKCMLircBase->theExtensions, i18n("Remote Controls")); + a->setOpen(true); + remoteMap.clear(); + TQDict dict = theServer->remotes(); + TQDictIterator i(dict); + for(; i.current(); ++i) + remoteMap[new TQListViewItem(a, i.current()->name())] = i.currentKey(); + } + updateInformation(); +} + +void KCMLirc::updateInformation() +{ + theKCMLircBase->theInformation->clear(); + theKCMLircBase->theInformationLabel->setText(""); + + if(!theKCMLircBase->theExtensions->selectedItem()) return; + + if(!theKCMLircBase->theExtensions->selectedItem()->parent()) + { + theKCMLircBase->theInformationLabel->setText(i18n("Information on %1:").arg(theKCMLircBase->theExtensions->selectedItem()->text(0))); + if(theKCMLircBase->theExtensions->selectedItem()->text(0) == i18n("Applications")) + new TQListViewItem(theKCMLircBase->theInformation, i18n("Number of Applications"), TQString().setNum(theKCMLircBase->theExtensions->selectedItem()->childCount())); + else if(theKCMLircBase->theExtensions->selectedItem()->text(0) == i18n("Remote Controls")) + new TQListViewItem(theKCMLircBase->theInformation, i18n("Number of Remote Controls"), TQString().setNum(theKCMLircBase->theExtensions->selectedItem()->childCount())); + } + else if(theKCMLircBase->theExtensions->selectedItem()->parent()->text(0) == i18n("Applications")) + { + ProfileServer *theServer = ProfileServer::profileServer(); + const Profile *p = theServer->profiles()[profileMap[theKCMLircBase->theExtensions->selectedItem()]]; + new TQListViewItem(theKCMLircBase->theInformation, i18n("Extension Name"), p->name()); + new TQListViewItem(theKCMLircBase->theInformation, i18n("Extension Author"), p->author()); + new TQListViewItem(theKCMLircBase->theInformation, i18n("Application Identifier"), p->id()); + new TQListViewItem(theKCMLircBase->theInformation, i18n("Number of Actions"), TQString().setNum(p->actions().count())); + theKCMLircBase->theInformationLabel->setText(i18n("Information on %1:").arg(p->name())); + } + else if(theKCMLircBase->theExtensions->selectedItem()->parent()->text(0) == i18n("Remote Controls")) + { + RemoteServer *theServer = RemoteServer::remoteServer(); + const Remote *p = theServer->remotes()[remoteMap[theKCMLircBase->theExtensions->selectedItem()]]; + new TQListViewItem(theKCMLircBase->theInformation, i18n("Extension Name"), p->name()); + new TQListViewItem(theKCMLircBase->theInformation, i18n("Extension Author"), p->author()); + new TQListViewItem(theKCMLircBase->theInformation, i18n("Remote Control Identifier"), p->id()); + new TQListViewItem(theKCMLircBase->theInformation, i18n("Number of Buttons"), TQString().setNum(p->buttons().count())); + theKCMLircBase->theInformationLabel->setText(i18n("Information on %1:").arg(p->name())); + } +} + +void KCMLirc::load() +{ + KSimpleConfig theConfig("irkickrc"); + allActions.loadFromConfig(theConfig); + allModes.loadFromConfig(theConfig); + allModes.generateNulls(IRKick_stub("irkick", "IRKick").remotes()); + + updateExtensions(); + updateModes(); + updateActions(); +} + +void KCMLirc::defaults() +{ + // insert your default settings code here... + emit changed(true); +} + +void KCMLirc::save() +{ + KSimpleConfig theConfig("irkickrc"); + allActions.saveToConfig(theConfig); + allModes.saveToConfig(theConfig); + + theConfig.sync(); + IRKick_stub("irkick", "IRKick").reloadConfiguration(); + + emit changed(true); +} + +void KCMLirc::configChanged() +{ + // insert your saving code here... + emit changed(true); +} + +// TODO: Take this out when I know how +extern "C" +{ + KDE_EXPORT TDECModule *create_kcmlirc(TQWidget *parent, const char *) + { TDEGlobal::locale()->insertCatalogue("kcmlirc"); + return new KCMLirc(parent, "KCMLirc"); + } +} + +#include + +#include "kcmlirc.moc" diff --git a/tdelirc/kcmlirc/kcmlirc.desktop b/tdelirc/kcmlirc/kcmlirc.desktop new file mode 100644 index 0000000..09033c1 --- /dev/null +++ b/tdelirc/kcmlirc/kcmlirc.desktop @@ -0,0 +1,119 @@ +[Desktop Entry] +Icon=irkick +Comment=Configure your remote controls for use with applications +Comment[ar]=إعداد التحكّم عن بعد لاستخدامه في تطبيقاتك +Comment[bg]=Настройване на дистанционното управление +Comment[bs]=Podesite vaš daljinski upravljač za upotrebu sa programima +Comment[ca]=Configura els teus controls remots per usar amb aplicacions +Comment[cs]=Nastavení dálkových ovladačů +Comment[cy]=Ffurfweddu eich rheolyddion pell ar gyfer ddefnydd efo cymhwysiadau +Comment[da]=Indstil dine fjernbetjeninger til brug for programmer +Comment[de]=Einrichtung diverser Applikationen zur Bedienung mit einer Fernsteuerung +Comment[el]=Ρυθμίστε τα τηλεχειριστήρια σας για χρήση σε εφαρμογές +Comment[es]=Configurar sus controles remotos para usarlos en las aplicaciones +Comment[et]=Kaugjuhtimise seadistamine rakenduste jaoks +Comment[eu]=Konfiguratu zure urruneko kontrolak aplikazioekin erabiltzeko +Comment[fa]=برای استفاده با کاربردها، کنترلهای از راه دورتان را پیکربندی کنید +Comment[fi]=Muokkaa kauko-ohjaimesi toimimaan ohjelmien kanssa +Comment[fr]=Configurer vos contrôleurs distants pour l'utiliser avec vos applications +Comment[ga]=Cumraigh do chuid cianrialtáin chun iad a úsáid le feidhmchláir +Comment[he]=הגדרת שלט רחוק לשימוש ביישומים +Comment[hi]=अनुप्रयोगों के साथ उपयोग के लिए अपने रिमोट नियंत्रण को कॉन्फ़िगर करें +Comment[hu]=Az infravörös távirányítók jellemzői +Comment[is]=Her má stilla fjarstýringar ýmissa forrita +Comment[it]=Configura i telecomandi per l'uso con le applicazioni +Comment[ja]=アプリケーションで使用するリモートコントロールを設定 +Comment[ka]=დააკონფიგურირეთ თქვენი დაშორებული მართვა ამ პროგრამით +Comment[kk]=Қашықтан басқаруды қолданбалармен қолдану үшін баптау +Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​ការបញ្ជា​ពី​ចម្ងាយ​របស់​អ្នក សម្រាប់​ការប្រើ​ជាមួយនឹង​កម្មវិធី +Comment[lt]=Nuotolinio valdymo programomis konfigūravimas +Comment[mk]=Конфигурирајте ги вашите далечински управувачи за користење со апликации +Comment[nb]=Sett opp fjernkontroll for bruk mot programmer +Comment[nds]=Feernbedeners för den Bruuk mit Programmen instellen +Comment[ne]=अनुप्रयोगसँग प्रयोग गर्न तपाईंको टाढाको नियन्त्रण कन्फिगर गर्नुहोस् +Comment[nl]=Uw afstandsbedieningen instellen voor gebruik in TDE +Comment[nn]=Set opp bruken av fjernkontroll i ulike program +Comment[pa]=ਕਾਰਜਾਂ ਨਾਲ ਵਰਤਣ ਲਈ ਆਪਣੇ ਰਿਮੋਟ ਕੰਟਰੋਲ ਦੀ ਸੰਰਚਨਾ ਕਰੋ +Comment[pl]=Konfiguruje piloty do użycia w programach +Comment[pt]=Configure os seus comandos à distância para os usar nas aplicações +Comment[pt_BR]=Configura seus controles remotos para o uso com as aplicações +Comment[ro]=Configurează telecomneziile de utilizat cu aplicaţii +Comment[ru]=Настройка удалённого управления приложениями +Comment[sk]=Nastavenie diaľkového ovládania pre vaše aplikácie +Comment[sl]=Nastavite vaš daljinski upravljalnik za uporabo v programih +Comment[sr]=Подесите контроле вашег даљинског управљача за употребу у програмима +Comment[sr@Latn]=Podesite kontrole vašeg daljinskog upravljača za upotrebu u programima +Comment[sv]=Ställ in fjärrkontroller att använda med program +Comment[ta]=பயன்பாடுகளுடன் பயன்படுத்த தொலைதூர கட்டுப்பாடுகளை வடிவமை +Comment[tg]=Ба воситаи замимаҳо танзимкунии идоракунии дурдасти шумо +Comment[tr]=Uzaktan kontrol ayarlarınızı uygulamalarla kullanmak için ayarla +Comment[uk]=Налаштування елементів дистанційного керування для використання з програмами +Comment[zh_CN]=配置您的远程控制以供应用程序使用 +Comment[zh_TW]=設定遙控按鍵與應用程式的關聯 +Exec=tdecmshell kcmlirc +Keywords=KCMLirc,kcmlirc +Keywords[bg]=дистанционно устройство, дистанционно, инфрачервени, лъчи, KCMLirc, kcmlirc +Keywords[nl]=kcmlirc,linux infrarood,infrarood,afstandsbediening +Keywords[pl]=KCMLirc,kcmlirc,piloty,podczerwień +Keywords[pt]=kcmlirc +Keywords[ta]= KCMLirc,kcmlirc +Keywords[uz]=KCMLirc,kcmlirc,infraqizil nur +Keywords[uz@cyrillic]=KCMLirc,kcmlirc,инфрақизил нур +Name=Remote Controls +Name[ar]=التحكّم عن بعد +Name[bg]=Дистанционно +Name[bs]=Daljinsko upravljanje +Name[ca]=Controls remots +Name[cs]=Dálková ovládání +Name[cy]=Rheolyddion Pell +Name[da]=Fjernbetjeninger +Name[de]=Fernsteuerungen +Name[el]=Τηλεχειριστήρια +Name[eo]=Teleregiloj +Name[es]=Controles remotos +Name[et]=Kaugjuhtimine +Name[eu]=Urruneko Aginteak +Name[fa]=کنترلهای از راه دور +Name[fi]=Kauko-ohjaimet +Name[fr]=Contrôleurs distants +Name[ga]=Cianrialtáin +Name[he]=שליטה מרחוק +Name[hi]=रिमोट नियंत्रण +Name[hu]=Távirányító +Name[is]=Fjarstýringar +Name[it]=Telecomandi +Name[ja]=リモートコントロール +Name[ka]=დაშორებული მართვა +Name[kk]=Қашықтан басқару +Name[km]=បញ្ជា​ពី​ចម្ងាយ +Name[lt]=Nuotolinis valdymas +Name[mk]=Далечински управувачи +Name[nb]=Fjernkontroll +Name[nds]=Feernbedeners +Name[ne]=टाढाको नियन्त्रण +Name[nl]=Afstandsbediening +Name[nn]=Fjernkontrollar +Name[pa]=ਰਿਮੋਟ ਕੰਟਰੋਲ +Name[pl]=Piloty +Name[pt]=Comandos à Distância +Name[pt_BR]=Controles Remotos +Name[ro]=Telecomenzi +Name[ru]=Удалённое управление +Name[sk]=Diaľkový ovládač +Name[sl]=Daljinski upravljalci +Name[sr]=Даљински управљачи +Name[sr@Latn]=Daljinski upravljači +Name[sv]=Fjärrkontroller +Name[ta]= தொலைதூர கட்டுப்பாடுகள் +Name[tg]=Идоракунии Дурдаст +Name[tr]=Uzaktan Kontroller +Name[uk]=Елементи дистанційного керування +Name[zh_CN]=远程控制 +Name[zh_TW]=遙控鍵 +Terminal=false +Type=Application +X-TDE-FactoryName=kcmlirc +X-TDE-Library=kcmlirc +X-TDE-ModuleType=Library +DocPath=kcmlirc/index.html +Categories=Qt;TDE;X-TDE-settings-peripherals; diff --git a/tdelirc/kcmlirc/kcmlirc.h b/tdelirc/kcmlirc/kcmlirc.h new file mode 100644 index 0000000..207c995 --- /dev/null +++ b/tdelirc/kcmlirc/kcmlirc.h @@ -0,0 +1,85 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef _KCMLIRC_H_ +#define _KCMLIRC_H_ + +#include +#include + +#include + +#include + +#include "kcmlircbase.h" +#include "iractions.h" +#include "modes.h" + +class TQListViewItem; +class TDEListView; +class TQDropEvent; +class Profile; +class Remote; + +class KCMLirc: public TDECModule, virtual public DCOPObject +{ + Q_OBJECT +// + K_DCOP + +private: + KCMLircBase *theKCMLircBase; + IRActions allActions; + Modes allModes; + TQMap actionMap; + TQMap modeMap; + TQMap profileMap, remoteMap; + + void autoPopulate(const Profile &profile, const Remote &remote, const TQString &mode); + +public slots: + void updateActions(); + void updateModesStatus(TQListViewItem *); + void updateActionsStatus(TQListViewItem *); + void updateModes(); + void updateExtensions(); + void updateInformation(); + void slotAddMode(); + void slotRemoveMode(); + void slotSetDefaultMode(); + void slotAddAction(); + void slotAddActions(); + void slotEditAction(); + void slotRemoveAction(); + void slotDrop(TDEListView *, TQDropEvent *, TQListViewItem *, TQListViewItem *after); + void slotRenamed(TQListViewItem *item); + void slotEditMode(); + +#ifndef Q_MOC_RUN +// MOC_SKIP_BEGIN +k_dcop: +// MOC_SKIP_END +#endif + // now just used as a proxy to AddAction class + virtual void gotButton(TQString remote, TQString button); +signals: + void haveButton(const TQString &remote, const TQString &button); + +public: + virtual void load(); + virtual void save(); + virtual void defaults(); + virtual void configChanged(); + + KCMLirc(TQWidget *parent = 0, const char *name = 0, TQStringList args = TQStringList()); + ~KCMLirc(); +}; + +#endif diff --git a/tdelirc/kcmlirc/kcmlircbase.ui b/tdelirc/kcmlirc/kcmlircbase.ui new file mode 100644 index 0000000..b5b21bf --- /dev/null +++ b/tdelirc/kcmlirc/kcmlircbase.ui @@ -0,0 +1,506 @@ + +KCMLircBase +Gav Wood + + + KCMLircBase + + + + 0 + 0 + 469 + 326 + + + + Linux Infrared Remote Control + + + + unnamed + + + 0 + + + + tabWidget2 + + + 0 + + + + tab + + + Controller Functions + + + + unnamed + + + + theMainLabel + + + + 5 + 0 + 0 + 0 + + + + + 138 + 0 + 0 + + + + + 1 + + + + NoFrame + + + 1 + + + There are currently no remote controls available. You must first set up LIRC correctly; see www.lirc.org for more information. + + + WordBreak|AlignTop + + + + + splitter4 + + + Horizontal + + + + modeLayout + + + + unnamed + + + 0 + + + + theRemotesLabel + + + Remote controls and modes: + + + + + + New Column + + + true + + + true + + + + + New Column + + + true + + + true + + + + theModes + + + true + + + true + + + true + + + + + modeButtonLayout + + + + unnamed + + + + spacer6 + + + Horizontal + + + Expanding + + + + 17 + 20 + + + + + + theAddMode + + + false + + + &Add... + + + + + theEditMode + + + false + + + &Edit... + + + + + theRemoveMode + + + false + + + &Remove + + + + + + + + + layout9 + + + + unnamed + + + 0 + + + + theModeLabel + + + + + + + + + Button + + + true + + + true + + + + + Program + + + true + + + true + + + + + Function + + + true + + + true + + + + + Options + + + true + + + true + + + + + Notes + + + true + + + true + + + + theActions + + + + 7 + 7 + 2 + 0 + + + + true + + + FileManager + + + true + + + + + layout7 + + + + unnamed + + + + spacer1 + + + Horizontal + + + Expanding + + + + 240 + 21 + + + + + + layout6 + + + + unnamed + + + + theAddActions + + + false + + + Auto-Populate... + + + + + + + + theAddAction + + + false + + + A&dd... + + + + + theEditAction + + + false + + + Ed&it... + + + + + theRemoveAction + + + false + + + Re&move + + + + + + + + + + + + + + tab + + + Loaded Extensions + + + + unnamed + + + + splitter5 + + + Horizontal + + + + + Name + + + true + + + true + + + + theExtensions + + + true + + + true + + + + + layout9 + + + + unnamed + + + 0 + + + + theInformationLabel + + + + + + + + + Name + + + true + + + true + + + + + Information + + + true + + + true + + + + theInformation + + + true + + + + + + + + + + + + kcmlircbase.ui.h + + + init() + + + + tdelistview.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + tdelistview.h + kpushbutton.h + kpushbutton.h + kpushbutton.h + tdelistview.h + tdelistview.h + + diff --git a/tdelirc/kcmlirc/kcmlircbase.ui.h b/tdelirc/kcmlirc/kcmlircbase.ui.h new file mode 100644 index 0000000..dcf2ec3 --- /dev/null +++ b/tdelirc/kcmlirc/kcmlircbase.ui.h @@ -0,0 +1,37 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename functions or slots use +** TQt Designer which will update this file, preserving your code. Create an +** init() function in place of a constructor, and a destroy() function in +** place of a destructor. +*****************************************************************************/ + +#include "modeslist.h" + +void KCMLircBase::init() +{ + delete theModes; + modeLayout->removeItem(modeButtonLayout); + theModes = new ModesList(TQT_TQWIDGET(modeLayout->parent()), "theModes"); + theModes->addColumn(i18n("Remote Control")); + theModes->addColumn(i18n("Default")); + theModes->addColumn(i18n("Icon")); + theModes->setAcceptDrops(true); + theModes->setRootIsDecorated(true); + theModes->setItemsRenameable(true); + modeLayout->addWidget(theModes); + modeLayout->addLayout(modeButtonLayout); + modeLayout->invalidate(); + modeLayout->activate(); +} diff --git a/tdelirc/kcmlirc/modeslist.cpp b/tdelirc/kcmlirc/modeslist.cpp new file mode 100644 index 0000000..1665e64 --- /dev/null +++ b/tdelirc/kcmlirc/modeslist.cpp @@ -0,0 +1,33 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood , (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include + +#include + +#include "modeslist.h" + +ModesList::ModesList(TQWidget *parent, const char *name) : TDEListView(parent, name) +{ + setAcceptDrops(true); + setDropVisualizer(false); + setDropHighlighter(true); +} + +bool ModesList::acceptDrag(TQDropEvent *) const +{ + // TODO: make safer by checking source/mime type + // TODO: make safer by only allowing drops on the correct remote control's modes + return true; +} + +#include "modeslist.moc" diff --git a/tdelirc/kcmlirc/modeslist.h b/tdelirc/kcmlirc/modeslist.h new file mode 100644 index 0000000..d6a4b25 --- /dev/null +++ b/tdelirc/kcmlirc/modeslist.h @@ -0,0 +1,34 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood , (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef MODESLIST_H +#define MODESLIST_H + +#include + +#include + +/** + +@author Gav Wood +*/ + +class ModesList : public TDEListView +{ + Q_OBJECT + +public: + virtual bool acceptDrag(TQDropEvent *) const; + ModesList(TQWidget *parent = 0, const char *name = 0); +}; + +#endif diff --git a/tdelirc/kcmlirc/newmode.ui b/tdelirc/kcmlirc/newmode.ui new file mode 100644 index 0000000..811b493 --- /dev/null +++ b/tdelirc/kcmlirc/newmode.ui @@ -0,0 +1,158 @@ + +NewMode + + + NewMode + + + + 0 + 0 + 309 + 341 + + + + New Mode + + + + unnamed + + + + + Remote Controls + + + true + + + true + + + + theRemotes + + + true + + + + + layout11 + + + + unnamed + + + + textLabel5 + + + Name: + + + + + theName + + + + + + + line2 + + + HLine + + + Sunken + + + Horizontal + + + + + layout12 + + + + unnamed + + + + spacer7 + + + Horizontal + + + Expanding + + + + 61 + 21 + + + + + + kPushButton6 + + + false + + + &OK + + + + + kPushButton5 + + + &Cancel + + + + + + + + + kPushButton6 + clicked() + NewMode + accept() + + + kPushButton5 + clicked() + NewMode + reject() + + + theName + textChanged(const TQString&) + NewMode + slotTextChanged(const TQString&) + + + + newmode.ui.h + + + slotTextChanged( const TQString & newText ) + + + + tdelistview.h + kpushbutton.h + kpushbutton.h + + diff --git a/tdelirc/kcmlirc/newmode.ui.h b/tdelirc/kcmlirc/newmode.ui.h new file mode 100644 index 0000000..29c4166 --- /dev/null +++ b/tdelirc/kcmlirc/newmode.ui.h @@ -0,0 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename functions or slots use +** TQt Designer which will update this file, preserving your code. Create an +** init() function in place of a constructor, and a destroy() function in +** place of a destructor. +*****************************************************************************/ + + +void NewMode::slotTextChanged( const TQString &newText ) +{ + kPushButton6->setEnabled(newText != ""); +} diff --git a/tdelirc/kcmlirc/selectprofile.ui b/tdelirc/kcmlirc/selectprofile.ui new file mode 100644 index 0000000..911deb4 --- /dev/null +++ b/tdelirc/kcmlirc/selectprofile.ui @@ -0,0 +1,128 @@ + +SelectProfile + + + SelectProfile + + + + 0 + 0 + 263 + 328 + + + + Select Profile to Add + + + + unnamed + + + + + Profile Name + + + true + + + true + + + + theProfiles + + + true + + + + + line8 + + + HLine + + + Sunken + + + Horizontal + + + + + layout47 + + + + unnamed + + + + spacer53 + + + Horizontal + + + Expanding + + + + 40 + 20 + + + + + + kPushButton12 + + + true + + + &OK + + + true + + + + + kPushButton13 + + + &Cancel + + + + + + + + + + + kPushButton12 + clicked() + SelectProfile + accept() + + + kPushButton13 + clicked() + SelectProfile + reject() + + + + + tdelistview.h + kpushbutton.h + kpushbutton.h + + -- cgit v1.2.1