From 5dac0856cb400a4f40280e7caae188781dac7b85 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 22 May 2008 06:47:43 +0000 Subject: Made script take current user into account. Generalized some naming stuff. --- client/builder.cc | 10 +++------- client/builder.h | 1 - client/macro.cc | 3 ++- client/pracro.ini | 2 +- tools/PracroAdd | 43 +++++++++++++++++++++++++++---------------- 5 files changed, 33 insertions(+), 26 deletions(-) diff --git a/client/builder.cc b/client/builder.cc index b5a9928..63cdcb9 100644 --- a/client/builder.cc +++ b/client/builder.cc @@ -27,12 +27,8 @@ extern QString user; Builder::Builder(QDomDocument *xml_doc) : QObject() { - // Assign root element from xml_doc - this->xml_doc = xml_doc; - QDomElement xml_elem = xml_doc->documentElement(); - // Execute the recursive function with documentElement - recurser(xml_elem, NULL); + recurser(xml_doc->documentElement(), NULL); } Builder::~Builder() @@ -224,8 +220,8 @@ void Builder::cont(QString name) mainwidget->close(); } else { QMessageBox::critical(NULL, "Fejl", - "Makroen er ikke udfyldt korrekt, prøv igen.\n" - , QMessageBox::Ok); + "Makroen er ikke udfyldt korrekt, prøv igen.\n", + QMessageBox::Ok); } printf("%s : Builder -> continuing...\n", macro.toStdString().c_str()); } diff --git a/client/builder.h b/client/builder.h index 735b58d..1fbbb86 100644 --- a/client/builder.h +++ b/client/builder.h @@ -52,7 +52,6 @@ public slots: private: bool doCommit(); void recurser(QDomNode xml_node, QWidget *parent); - QDomDocument *xml_doc; QVector< Widget* > widgets; QString macro; QString version; diff --git a/client/macro.cc b/client/macro.cc index 08a956a..d06e4c0 100644 --- a/client/macro.cc +++ b/client/macro.cc @@ -64,6 +64,7 @@ void create_macro(QString name) QDomDocument xml_doc; if (!xml_doc.setContent(ba)) { printf("ERROR: Invalid XML recieved!\n"); + fwrite(ba.data(), ba.size(), 1, stdout); } // Initiate the macro builder with the xml document @@ -99,7 +100,7 @@ static QDomDocument xml_request(QString name) printf("macro: %s, cpr: %s, user: %s\n", name.toStdString().c_str(), cpr.toStdString().c_str(), user.toStdString().c_str()); xml_array.append("\n"); xml_array.append("\n"); - xml_array.append(" \n"); + xml_array.append(" \n"); xml_array.append(""); // Print to stdout for debug purposes diff --git a/client/pracro.ini b/client/pracro.ini index 8c33be6..8192ea5 100644 --- a/client/pracro.ini +++ b/client/pracro.ini @@ -1,3 +1,3 @@ [server] -host=gargamel.j.auh.dk +host=127.0.0.1 port=12345 diff --git a/tools/PracroAdd b/tools/PracroAdd index acbe519..6c9d9fa 100644 --- a/tools/PracroAdd +++ b/tools/PracroAdd @@ -1,6 +1,9 @@ -# -*- mode: shell-script; sh-shell: bash; sh-indentation: 2 -*- +#!/bin/bash +PROJECT="Pracro" function allfile() { + WHO="`whoami`" + echo "/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */" > $1; echo "/***************************************************************************" >> $1; echo " * $1" >> $1; @@ -8,25 +11,38 @@ function allfile() { echo " * `date`" >> $1; echo -n " * Copyright " >> $1 echo -n `date +%Y | xargs` >> $1 - echo " Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup" >> $1; - echo " * deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk" >> $1; + if [ "$WHO" == "deva" ]; + then + echo " Bent Bisballe Nyeng" >> $1; + echo " * deva@aasimon.org" >> $1; + fi + if [ "$WHO" == "elsenator" ]; + then + echo "Lars Bisballe Jensen" >> $1; + echo " * elsenator@gmail.com" >> $1; + fi + if [ "$WHO" == "piparum" ]; + then + echo "Peter Skaarup" >> $1; + echo " * and piparum@piparum.dk" >> $1; + fi echo " ****************************************************************************/" >> $1; echo "" >> $1; echo "/*" >> $1; - echo " * This file is part of Pracro." >> $1; + echo " * This file is part of $PROJECT." >> $1; echo " *" >> $1; - echo " * Pracro is free software; you can redistribute it and/or modify" >> $1; + echo " * $PROJECT is free software; you can redistribute it and/or modify" >> $1; echo " * it under the terms of the GNU General Public License as published by" >> $1; echo " * the Free Software Foundation; either version 2 of the License, or" >> $1; echo " * (at your option) any later version." >> $1; echo " *" >> $1; - echo " * Pracro is distributed in the hope that it will be useful," >> $1; + echo " * $PROJECT is distributed in the hope that it will be useful," >> $1; echo " * but WITHOUT ANY WARRANTY; without even the implied warranty of" >> $1; echo " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" >> $1; echo " * GNU General Public License for more details." >> $1; echo " *" >> $1; echo " * You should have received a copy of the GNU General Public License" >> $1; - echo " * along with Pracro; if not, write to the Free Software" >> $1; + echo " * along with $PROJECT; if not, write to the Free Software" >> $1; echo " * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA." >> $1; echo " */" >> $1; } @@ -45,15 +61,10 @@ function ccfile() { function hfile() { allfile $1; local hn=`echo $1 | tr 'a-z.' 'A-Z_'` - echo -n "#ifndef __PRACRO_" >> $1; - echo -n "$hn" >> $1; - echo "__" >> $1; - echo -n "#define __PRACRO_" >> $1; - echo -n "$hn" >> $1; - echo "__" >> $1; - echo -n "#endif/*__PRACRO_" >> $1; - echo -n "$hn" >> $1; - echo "__*/" >> $1; + local pr=`echo $PROJECT | tr 'a-z.' 'A-Z_'` + echo "#ifndef __${pr}_${hn}__" >> $1; + echo "#define __${pr}_${hn}__" >> $1; + echo "#endif/*__${pr}_${hn}__" >> $1; } if [ "$#" = "1" ]; then -- cgit v1.2.3