Commit 9a8b6287 authored by Thiago H. S. Picharski's avatar Thiago H. S. Picharski

Merge remote branch 'le-search/master'

Signed-off-by: 's avatarThiago H. S. Picharski <thsp08@c3sl.ufpr.br>
parents d4825022 0666317b
#!/bin/bash
# gerar.sh
# Copyright (c) 2006 by Bruno Ribas <ribas@ufpr.br>
DIRTMP=$(mktemp -d)
VERSAO=$(cat VERSAO)
#arrumar versao
#$1 tipo de incremento
MAJOR=$(echo $VERSAO| cut -d'.' -f1)
MINOR=$(echo $VERSAO| cut -d'.' -f2)
REVISION=$(echo $VERSAO| cut -d'.' -f3)
case $1 in
Minor)
((MINOR++))
REVISION=0
;;
Major)
((MAJOR++))
MINOR=0
REVISION=0
;;
help)
echo "Uso: $0 Major|Minor|Revision"
echo ' Major - Altera versao Major'
echo ' Minor - Altera versao Minor'
exit
;;
*)
((REVISION++))
;;
esac
VERSAO="${MAJOR}.${MINOR}.${REVISION}"
echo "$VERSAO" > VERSAO
#Compila a documentacao do pacote no diretorio doc/
#cd doc/
#hevea -text *.tex
#hevea -text *.tex
#cd ../
cp -r pacote $DIRTMP
#Copia a documentacao compilada para dentro do pacote.
#cp doc/*.txt $DIRTMP/pacote/usr/share/doc/prd-*
cd $DIRTMP
find . -name ".svn" -exec rm -rf {} \; &>/dev/null
sed -i -e "s/Version:/Version: $VERSAO/" pacote/DEBIAN/control
fakeroot dpkg -b pacote .
cd -
cp $DIRTMP/*deb .
rm -rf $DIRTMP
# vim:tabstop=4:shiftwidth=4:encoding=iso-8859-1
Package: le-search
Section: main
Priority: important
Version:
Architecture: i386
Depends: libxml2, konqueror, libqt4-dev
Maintainer: LE Maintainer <le-maintainer@c3sl.ufpr.br>
Description: Search tool for educational content of Linux Educacional project
# LE-SEARCH
C3SL - Centro de Computacao Cientifica e Software Livre
Adriano da Luz
Bruno Cesar Ribas
Carlos Carvalho
Cleide Luzia Bonfim Possamai
Danilo Kiyoshi Simizu Yorinori
Diego Giovane Pasqualin
Eduardo Todt
Erik Alexandre Pucci
Felipe Cys Laskoski
Guilherme Zasyeki Machado
Josiney de Souza
Juliana Bueno
Klismann Smoger Mottin
Laura Sanchez Garcia
Luis Carlos Erpen de Bona
Marcela Saragioto
Marcos Castilho
Pedro Eugenio Rocha
Renan Franca De Miranda
Ricardo Tavares De Oliveira
Rubens Massayuki Suguimoto
Thiago Henrique Dos Santos Picharski
Tiago Rodrigo Kepe
Victor Tarabola Cortiano
Vinicius Kwiecien Ruoso
This diff is collapsed.
#############################################################################
# Makefile for building: qt
# Generated by qmake (2.01a) (Qt 4.7.0) on: qui jan 27 10:12:45 2011
# Project: qt.pro
# Template: app
# Command: /usr/bin/qmake -o Makefile qt.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I/usr/include/libxml2 -I. -I. -I.
LINK = g++
LFLAGS = -Wl,-O1
LIBS = $(SUBLIBS) -L/usr/lib -lQtGui -lQtCore -lpthread -lxml2
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
STRIP = strip
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = categorize.cpp \
convert.c \
main.cpp \
mySearch.cpp \
readXml.c \
walk.c moc_mySearch.cpp
OBJECTS = categorize.o \
convert.o \
main.o \
mySearch.o \
readXml.o \
walk.o \
moc_mySearch.o
DIST = /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/release.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
qt.pro
QMAKE_TARGET = le-search
DESTDIR =
TARGET = le-search
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
####### Build rules
all: Makefile $(TARGET)
$(TARGET): ui_mySearch.h ui_mySearchHelp.h $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: qt.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/release.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
/usr/lib/libQtGui.prl \
/usr/lib/libQtCore.prl
$(QMAKE) -o Makefile qt.pro
/usr/share/qt4/mkspecs/common/g++.conf:
/usr/share/qt4/mkspecs/common/unix.conf:
/usr/share/qt4/mkspecs/common/linux.conf:
/usr/share/qt4/mkspecs/qconfig.pri:
/usr/share/qt4/mkspecs/features/qt_functions.prf:
/usr/share/qt4/mkspecs/features/qt_config.prf:
/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
/usr/share/qt4/mkspecs/features/default_pre.prf:
/usr/share/qt4/mkspecs/features/release.prf:
/usr/share/qt4/mkspecs/features/default_post.prf:
/usr/share/qt4/mkspecs/features/warn_on.prf:
/usr/share/qt4/mkspecs/features/qt.prf:
/usr/share/qt4/mkspecs/features/unix/thread.prf:
/usr/share/qt4/mkspecs/features/moc.prf:
/usr/share/qt4/mkspecs/features/resources.prf:
/usr/share/qt4/mkspecs/features/uic.prf:
/usr/share/qt4/mkspecs/features/yacc.prf:
/usr/share/qt4/mkspecs/features/lex.prf:
/usr/share/qt4/mkspecs/features/include_source_dir.prf:
/usr/lib/libQtGui.prl:
/usr/lib/libQtCore.prl:
qmake: FORCE
@$(QMAKE) -o Makefile qt.pro
dist:
@$(CHK_DIR_EXISTS) .tmp/qt1.0.0 || $(MKDIR) .tmp/qt1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/qt1.0.0/ && $(COPY_FILE) --parents categorize.h convert.h main.h mySearch.h readXml.h walk.h .tmp/qt1.0.0/ && $(COPY_FILE) --parents categorize.cpp convert.c main.cpp mySearch.cpp readXml.c walk.c .tmp/qt1.0.0/ && $(COPY_FILE) --parents mySearch.ui mySearchHelp.ui .tmp/qt1.0.0/ && (cd `dirname .tmp/qt1.0.0` && $(TAR) qt1.0.0.tar qt1.0.0 && $(COMPRESS) qt1.0.0.tar) && $(MOVE) `dirname .tmp/qt1.0.0`/qt1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/qt1.0.0
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
check: first
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compiler_moc_header_make_all: moc_mySearch.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_mySearch.cpp
moc_mySearch.cpp: ui_mySearch.h \
ui_mySearchHelp.h \
walk.h \
readXml.h \
convert.h \
categorize.h \
mySearch.h
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) mySearch.h -o moc_mySearch.cpp
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all: ui_mySearch.h ui_mySearchHelp.h
compiler_uic_clean:
-$(DEL_FILE) ui_mySearch.h ui_mySearchHelp.h
ui_mySearch.h: mySearch.ui
/usr/bin/uic-qt4 mySearch.ui -o ui_mySearch.h
ui_mySearchHelp.h: mySearchHelp.ui
/usr/bin/uic-qt4 mySearchHelp.ui -o ui_mySearchHelp.h
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_header_clean compiler_uic_clean
####### Compile
categorize.o: categorize.cpp categorize.h \
readXml.h \
convert.h \
walk.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o categorize.o categorize.cpp
convert.o: convert.c
$(CC) -c $(CFLAGS) $(INCPATH) -o convert.o convert.c
main.o: main.cpp main.h \
mySearch.h \
ui_mySearch.h \
ui_mySearchHelp.h \
walk.h \
readXml.h \
convert.h \
categorize.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
mySearch.o: mySearch.cpp mySearch.h \
ui_mySearch.h \
ui_mySearchHelp.h \
walk.h \
readXml.h \
convert.h \
categorize.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o mySearch.o mySearch.cpp
readXml.o: readXml.c readXml.h \
convert.h
$(CC) -c $(CFLAGS) $(INCPATH) -o readXml.o readXml.c
walk.o: walk.c walk.h \
readXml.h \
convert.h
$(CC) -c $(CFLAGS) $(INCPATH) -o walk.o walk.c
moc_mySearch.o: moc_mySearch.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mySearch.o moc_mySearch.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:
#include <QtGui>
#include "categorize.h"
#include "readXml.h"
#include "walk.h"
using namespace std;
void categorizeXml(const char *xmlFile, map<string, set<string> >& M) {
xmlTextReaderPtr reader;
nodeContent node;
const xmlChar *name;
int ret;
string category, media;
reader = xmlReaderForFile(xmlFile, NULL, 0);
if (reader != NULL) {
ret = xmlTextReaderRead(reader);
while (ret == 1) {
name = xmlTextReaderConstName(reader);
if ( xmlTextReaderHasAttributes(reader) == 1 ) {
node.category = xmlTextReaderGetAttribute(reader, xmlCharStrdup("category"));
node.media = xmlTextReaderGetAttribute(reader, xmlCharStrdup("media"));
category = QString().fromLatin1((char *)node.category).toStdString();
media = QString().fromLatin1((char *)node.media).toStdString();
M[media].insert(category);
}
ret = xmlTextReaderRead(reader);
}
}
}
int categorize(const char *currentDirName, map<string, set<string> >& M)
{
struct dirent **contentDir;
struct stat contentDirStat;
char *tmpDirName;
int n_dir, i;
n_dir = scandir(currentDirName, &contentDir, 0, alphasort);
for (i = 0; i < n_dir; i++)
{
/* Ignore directories "." and ".." */
if( strcmp(contentDir[i]->d_name, ".")
&& strcmp(contentDir[i]->d_name, "..") )
{
tmpDirName = NULL;
/* Concatenates current directory path with
contentDir->d_name */
if( ! concatString(&tmpDirName, currentDirName, "/") )
return 0;
if( ! concatString(&tmpDirName, tmpDirName,
contentDir[i]->d_name) )
return 0;
/* Parse the type of current file */
if( lstat(tmpDirName, &contentDirStat) )
return 0;
/* Macro S_ISDIR returns true if st_mode is directory. */
if( S_ISDIR(contentDirStat.st_mode) )
{
if( ! categorize(tmpDirName,M) )
return 0;
}
else
if(strstr(tmpDirName,".xml"))
{
const char *xmlFile = tmpDirName;
categorizeXml(xmlFile, M);
return 1;
}
}
}
return 1;
}
#ifndef H_CATEGORIZE_H
#define H_CATEGORIZE_H
#include <map>
#include <set>
#include <string>
using namespace std;
void categorizeXml(const char *xmlFile, map<string, set<string> >& M);
int categorize(const char *currentDirName, map<string, set<string> >& M);
#endif
char * convertXmlToLower(char *source)
{
int i;
int source_size;
char *destination = (char *) malloc( sizeof(char));
int j = 0; /* "j" will save the current size of the "destination" */
source_size = strlen(source);
for( i = 0; i < source_size; i++ )
{
/* If the character is not sharp and are in lowercase, only copies
to the new word */
if ( source[i] >= 97 && source[i] <= 122 )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = source[i];
}
else
{
/* Detects "a" sharp and replaces it by character "a" */
if ( ( source[i] <= -124 && source[i] >= -128 ) ||
( source[i] <= -92 && source[i] >= -96 ) )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = 'a';
}
/* Detects "e" sharp and replaces it by character "e" */
if ( ( source[i] <= -117 && source[i] >= -120 ) ||
( source[i] <= -85 && source[i] >= -88 ) )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = 'e';
}
/* Detects "i" sharp and replaces it by character "i" */
if ( ( source[i] <= -113 && source[i] >= -116 ) ||
( source[i] <= -81 && source[i] >= -84 ) )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = 'i';
}
/* Detects "o" sharp and replaces it by character "o" */
if ( ( source[i] <= -106 && source[i] >= -110 ) ||
( source[i] <= -74 && source[i] >= -78 ) )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = 'o';
}
/* Detects "u" sharp and replaces it by character "u" */
if ( ( source[i] <= -100 && source[i] >= -103 ) ||
( source[i] <= -68 && source[i] >= -71 ) )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = 'u';
}
/* Detects "ç" and replace by character "c" */
if ( source[i] == -89 )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = 'c';
}
/* Converts uppercase to lowercase */
if ( source[i] >= 65 && source[i] <= 90 )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = source[i] + 32;
}
}
}
/* Ends the word with "\0" */
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = '\0';
return destination;
}
char * convertParamToLower(char *source)
{
int i;
int source_size;
char *destination = (char *) malloc( sizeof(char));
int j = 0; /* "j" will save the current size of the "destination" */
source_size = strlen(source);
for( i = 0; i < source_size; i++ )
{
/* If the character is not sharp and are in lowercase, only copies
to the new word */
if ( source[i] >= 97 && source[i] <= 122 )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = source[i];
}
else
{
/* Detects "a" sharp and replaces it by character "a" */
if ( ( source[i] <= -28 && source[i] >= -32 ) ||
( source[i] <= -60 && source[i] >= -64 ) )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = 'a';
}
/* Detects "e" sharp and replaces it by character "e" */
if ( ( source[i] <= -21 && source[i] >= -24 ) ||
( source[i] <= -53 && source[i] >= -56 ) )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = 'e';
}
/* Detects "i" sharp and replaces it by character "i" */
if ( ( source[i] <= -17 && source[i] >= -20 ) ||
( source[i] <= -49 && source[i] >= -52 ) )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = 'i';
}
/* Detects "o" sharp and replaces it by character "o" */
if ( ( source[i] <= -10 && source[i] >= -14 ) ||
( source[i] <= -42 && source[i] >= -46 ) || source[i]==179)
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = 'o';
}
/* Detects "u" sharp and replaces it by character "u" */
if ( ( source[i] <= -4 && source[i] >= -7 ) ||
( source[i] <= -36 && source[i] >= -39 ) )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = 'u';
}
/* Detects "ç" and replace by character "c" */
if ( source[i] == -25 )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = 'c';
}
/* Converts uppercase to lowercase */
if ( source[i] >= 65 && source[i] <= 90 )
{
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = source[i] + 32;
}
}
}
/* Ends the word with "\0" */
j++;
destination = (char*)realloc( destination, j * sizeof(char));
destination[j-1] = '\0';
return destination;
}
#ifndef H_CONVERT_H
#define H_CONVERT_H
#ifdef __cplusplus
extern "C"
{
#endif
char * convertXmlToLower(char *source);
char * convertParamToLower(char *source);
#ifdef __cplusplus
}
#endif
#endif
#include "main.h"
int main(int argc, char **argv)
{
QApplication app(argc, argv);
Search *dialog = new Search();
dialog->show();
return app.exec();
}
#ifndef H_MAIN_H
#define H_MAIN_H
#include <QApplication>
#include "mySearch.h"
#endif
#include <QtGui>
#include "mySearch.h"
#include "ui_mySearchHelp.h"
#include "categorize.h"
Search::Search( QWidget *parent )
{
setupUi(this);
resultArray.size = 0;
/* Catalogs subjects and disciplines */
categorize(DIR_FULL,Categories);
/* Connects the combo media */
connect( comboMedia, SIGNAL( currentIndexChanged(QString) ), this, SLOT(changeCategory(QString)) );
/* Conects the button search */
connect( pushButton_Search,SIGNAL( clicked() ), this, SLOT( searchClick() ) );
/* Connects the table to receive a double click. Open the file of the
selected row */
connect( tableResult, SIGNAL( doubleClicked(QModelIndex) ), this, SLOT(openFile(QModelIndex)) );
/* Conects to radioButton_1 e 2 */
connect(radioButton_1, SIGNAL( clicked() ), this, SLOT(radioButtonClick()) );
connect(radioButton_2, SIGNAL( clicked() ), this, SLOT(radioButtonClick_2()) );
connect(radioButton_3, SIGNAL( clicked() ), this, SLOT(radioButtonClick_3()) );
/* Conects to helpButton */
connect( helpButton, SIGNAL( clicked() ), this, SLOT( helpClick() ) );
/* Set images on buttons */
QIcon *searchImg = new QIcon("/usr/share/le-search/busca.png");
QIcon *helpImg = new QIcon("/usr/share/le-search/help2.png");
pushButton_Search->setFixedSize(96,20);
pushButton_Search->setIconSize(QSize(96,20));