#!/bin/bash

find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/Q_PROPERTY/TQ_PROPERTY/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/Q_ENUMS/TQ_ENUMS/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/Q_SETS/TQ_SETS/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/Q_OVERRIDE/TQ_OVERRIDE/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/Q_CLASSINFO/TQ_CLASSINFO/g' {} \;

find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/QT_POINTER_SIZE/TQT_POINTER_SIZE/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/\([^T]\)Qt3/\1TQt3/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/qt_main_thread/tqt_main_thread/g' {} \;

find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/RETQUEST/REQUEST/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/Actquire/Acquire/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/CONSETQUENTIAL/CONSEQUENTIAL/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/ETQUAL/EQUAL/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/ETQUATION/EQUATION/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/ETQUIV/EQUIV/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/Etquip/Equip/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/Intquire/Inquire/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/Martquis/Marquis/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/PRODTQUOT/PRODQUOT/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/Retquire/Require/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/Retquiring/Requiring/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/SETQUENCE/SEQUENCE/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/SETQUENT/SEQUENT/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/STQUARE/SQUARE/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/TQUALITY/QUALITY/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/TQUARTER/QUARTER/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/TQUERY/QUERY/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/TQUESTION/QUESTION/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/TQUEUE/QUEUE/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/TQUICK/QUICK/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/TQUIT/QUIT/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/TQUOTATION/QUOTATION/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/UNITQUE/UNIQUE/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/actquire/acquire/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/actquiring/acquiring/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/actquisition/acquisition/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/etquip/equip/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/intquire/inquire/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/intquiries/inquiries/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/martquis/marquis/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/relintquish/relinquish/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/retquier/requier/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/retquire/require/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/retquiring/requiring/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/retquisite/requisite/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/stquirt/squirt/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/tquick/quick/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/tquiet/quiet/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/tquirk/quirk/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/tquit/quit/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/tquiz/quiz/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/ubitquitous/ubiquitous/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/unitquifying/uniquifying/g' {} \;

find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/\([-()+/{*},.>!:=&[\t ]\)qt_shared/\1tqt_shared/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/\([-()+/{*},.>!:=&[\t ]\)qt_timer/\1tqt_timer/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/\([-()+/{*},.>!:=&[\t ]\)qThread/\1tqThread/g' {} \;

find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/^qt_shared/tqt_shared/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/^qt_timer/tqt_timer/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/^qThread/tqThread/g' {} \;

find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/qm2ts/tqm2ts/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/mergetr/tqtmergetr/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/msg2qm/msg2tqm/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/makeqpf/maketqpf/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/qvfb/tqvfb/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/createcw/tqtcreatecw/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/conv2ui/tqtconv2ui/g' {} \;

find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/findtr/tqtfindtr/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/qtrename140/tqtrename140/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/qt20fix/tqt20fix/g' {} \;

# Clean up unintended renames
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/ttqtconv2ui/tqtconv2ui/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/ttqvfb/tqvfb/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/BlindsQt::Vertical/Blinds::Vertical/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/BlindsQt::Horizontal/Blinds::Horizontal/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/Flip::Vertical/Flip::Vertical/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/Flip::Horizontal/Flip::Horizontal/g' {} \;

# Rename little-used libraries
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/-leditor/-ltqteditor/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/libeditor/libtqteditor/g' {} \;
find ./ -type f -iname "*.pro" -not -iwholename '*.git*' -exec sed -i 's/TARGET\(.*\) editor/TARGET\1 tqteditor/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/-ldesignercore/-ltqtdesignercore/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/libdesignercore/libtqtdesignercore/g' {} \;
find ./ -type f -iname "*.pro" -not -iwholename '*.git*' -exec sed -i 's/TARGET\(.*\) designercore/TARGET\1 tqtdesignercore/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/_designercore/_tqtdesignercore/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/-lqassistantclient/-ltqassistantclient/g' {} \;
find ./ -type f -iname "*" -not -iwholename '*.git*' -exec sed -i 's/libqassistantclient/libtqassistantclient/g' {} \;
find ./ -type f -iname "*.pro" -not -iwholename '*.git*' -exec sed -i 's/TARGET\(.*\) qassistantclient/TARGET\1 tqassistantclient/g' {} \;

exit 0
