├── .gitignore ├── README ├── README.md ├── config.in ├── config.pri ├── configure ├── debian ├── .qtcreator ├── README ├── changelog ├── compat ├── control ├── copyright └── rules ├── doc ├── TODO.txt ├── help-en_US.txt ├── help-zh_CN.txt └── history ├── i18n.pri ├── i18n ├── qop-zh_CN.qm ├── qop_zh-cn.qm └── qop_zh-cn.ts ├── qop.pro ├── qtc_packaging ├── debian_fremantle │ ├── README │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ └── rules └── debian_harmattan │ ├── README │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ └── rules ├── screenshots ├── qop-ezx.png ├── qop-maemo5.png ├── qop-ubuntu.png └── qop-win.png ├── src ├── QOutParser.cpp ├── QOutParser.h ├── Types.h ├── algorithm │ ├── zconf.h │ ├── zlib.h │ ├── zlib_alg.cpp │ └── zlib_alg.h ├── commandparser.cpp ├── commandparser.h ├── getopt.cpp ├── getopt.h ├── gui │ ├── ezprogressdialog.cpp │ ├── ezprogressdialog.h │ └── ezprogressdialog_p.h ├── main.cpp ├── msgdef.h ├── option.cpp ├── option.h ├── qarchive │ ├── arcreader.cpp │ ├── arcreader.h │ ├── gzip │ │ ├── GzipHeader.h │ │ ├── GzipItem.cpp │ │ └── GzipItem.h │ ├── qarchive.cpp │ ├── qarchive.h │ ├── qarchive_p.h │ ├── tar │ │ ├── TarHeader.h │ │ ├── TarItem.h │ │ ├── qtar.cpp │ │ └── qtar.h │ └── zip │ │ ├── ZipHeader.cpp │ │ └── ZipHeader.h ├── qcounterthread.cpp ├── qcounterthread.h ├── qop.cpp ├── qop.h ├── qtcompat.h ├── utils │ ├── convert.cpp │ ├── convert.h │ ├── qt_util.cpp │ ├── qt_util.h │ ├── strutil.cpp │ ├── strutil.h │ ├── util.cpp │ └── util.h └── version.h └── test ├── .findqop.sh ├── 7z-qop.sh ├── qop-tar.sh ├── qop-unrar.sh ├── qop-unzip.sh ├── qop-zip.sh ├── tar-qop.sh ├── unrar-zip.sh ├── unzip-qop.sh └── zip-qop.sh /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile* 2 | *.[oa] 3 | *.so* 4 | *.dll 5 | *.pro.* 6 | *.user 7 | 8 | #vc files 9 | *.ncb 10 | *.pdb 11 | *.layout 12 | *.suo 13 | 14 | #dirs 15 | .moc 16 | .obj 17 | /bin* 18 | /lib* 19 | 20 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Auther: Wang Bin (aka nukin in ccomve & novesky in motorolafans) 2 | Shanghai university, China 3 | 2010-09-09 4 | wbsecg1@gmail.com 5 | Other links: http://sourceforge.net/projects/qop/files 6 | http://qt-apps.org/content/show.php/qop?content=132430 7 | 8 | Qt Output Parser for tar, zip, unzip, unrar, 7z with a compression/extraction progress indicator. 9 | Support platforms: windows(Qt4), Linux(Qt4, tested on ubuntu 10.04), motorola ezx(Qt2, tested on ROKR E6) and Maemo5 etc. 10 | 11 | bug: can't kill 7z in windows. 12 | 13 | Usage: qop [-interval=Nunit] [--all] [-t parserFor] [-n|s] [-chm] [-x archieve|-T totalSteps] [files...] 14 | 15 | -a, --all: update all changes. default is update on timer event 16 | -F, --time-format=fmt: setup time format. utc(iso8601) or normal 17 | -m, --multi-thread: create a new thread to calculate progress bar's total steps. 18 | -i, --interval=Nunit: update the progress every N seconds/mseconds. unit can be s, sec[s],seconds(N can be float) or msec[s](N is int) 19 | -h, --help: help 20 | -n, --number: set number of files as total steps. 21 | -s, --size: set size of files as total steps. -s is default 22 | -T, --steps=STEPS: specify total steps. 23 | -t, --parser[=TYPE]: usually is tool's name, such as tar, zip, unzip, unrar. If using xz, lzop etc with tar, parser is tar. -t tar is default. 24 | If you want to extract a .tar or .tar.xxx file and set size as total steps, use -tuntar is better. 25 | -x, --exteact=ARCHIVE: extracting mode. Omit -T argument. Analyze parser and total steps automaticly. 26 | -o, --outdir=dir: set the output dir when using internal extract method(qop -d -x test.tar -o outdir) 27 | -c, --auto-close: auto close when finished 28 | -C, --cmd=command: execute command 29 | -d, --diy[=TARFILE]: using built-in method to extract an archive 30 | 31 | examples: 32 | qop -C zip -ryv -9 test.zip test 33 | qop -C zip -ry -9 test.zip test 34 | qop -C unzip -o test.zip -d exdir 35 | qop -C unrar x -o+ -p- -y rar.rar destdir 36 | qop -C tar cvvf test.tar test 37 | qop -C tar zcvf test.tgz test 38 | qop -C tar zxvvf test.tgz -C /tmp ##only 1 v will not show the right totalsteps and progress 39 | qop tar cvvf test.tar test 40 | tar zcvvf test.tgz test |qop test -m 41 | tar zxvvf test.tgz |qop -T `gzip -l test.tgz |sed -n '$s/\(.*\) \(.*\) .*/\2/p'` -tuntar -c 42 | tar zxvf test.tgz |qop -T `tar -zt = 0.2.2, you can omit -n and -s 53 | tar zcvvf test.tgz test |qop test [-m] 54 | tar zcvf test.tgz test |qop test ##no -m 55 | 56 | extracting a tar.gz file for new version(>=0.1.0): 57 | tar zxvvf test.tar.gz |qop -x test.tar.gz 58 | 59 | 60 | How To Compile: 61 | 1.Desktop and Maemo: Just use QtCreator. 62 | 2.EZX: Use tmake. Or use my configure script. Type 63 | ./configure 64 | make 65 | make pkg 66 | More information about configue script can be got by ./configure --help 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Alt text](https://github.com/wang-bin/qop/raw/master/screenshots/qop-maemo5.png "maemo5") 2 | ![Alt text](https://github.com/wang-bin/qop/raw/master/screenshots/qop-ubuntu.png "Ubuntu") 3 | ![Alt text](https://github.com/wang-bin/qop/raw/master/screenshots/qop-win.png "Win7") 4 | ![Alt text](https://github.com/wang-bin/qop/raw/master/screenshots/qop-ezx.png "EZX") 5 | 6 | Auther: Wang Bin (aka nukin in ccomve & novesky in motorolafans) 7 | Shanghai university, China 8 | 2010-09-09 9 | wbsecg1@gmail.com 10 | Other links: http://sourceforge.net/projects/qop/files 11 | http://qt-apps.org/content/show.php/qop?content=132430 12 | 13 | Qt Output Parser for tar, zip, unzip, unrar, 7z with a compression/extraction progress indicator. 14 | Support platforms: windows(Qt4), Linux(Qt4, tested on ubuntu 10.04), motorola ezx(Qt2, tested on ROKR E6) and Maemo5 etc. 15 | 16 | bug: can't kill 7z in windows. 17 | 18 | Usage: qop [-interval=Nunit] [--all] [-t parserFor] [-n|s] [-chm] [-x archieve|-T totalSteps] [files...] 19 | 20 | -a, --all: update all changes. default is update on timer event 21 | -F, --time-format=fmt: setup time format. utc(iso8601) or normal 22 | -m, --multi-thread: create a new thread to calculate progress bar's total steps. 23 | -i, --interval=Nunit: update the progress every N seconds/mseconds. unit can be s, sec[s],seconds(N can be float) or msec[s](N is int) 24 | -h, --help: help 25 | -n, --number: set number of files as total steps. 26 | -s, --size: set size of files as total steps. -s is default 27 | -T, --steps=STEPS: specify total steps. 28 | -t, --parser[=TYPE]: usually is tool's name, such as tar, zip, unzip, unrar. If using xz, lzop etc with tar, parser is tar. -t tar is default. 29 | If you want to extract a .tar or .tar.xxx file and set size as total steps, use -tuntar is better. 30 | -x, --exteact=ARCHIVE: extracting mode. Omit -T argument. Analyze parser and total steps automaticly. 31 | -o, --outdir=dir: set the output dir when using internal extract method(qop -d -x test.tar -o outdir) 32 | -c, --auto-close: auto close when finished 33 | -C, --cmd=command: execute command 34 | -d, --diy[=TARFILE]: using built-in method to extract an archive 35 | 36 | examples: 37 | 38 | qop -C zip -ryv -9 test.zip test 39 | qop -C zip -ry -9 test.zip test 40 | qop -C unzip -o test.zip -d exdir 41 | qop -C unrar x -o+ -p- -y rar.rar destdir 42 | qop -C tar cvvf test.tar test 43 | qop -C tar zcvf test.tgz test 44 | qop -C tar zxvvf test.tgz -C /tmp ##only 1 v will not show the right totalsteps and progress 45 | qop tar cvvf test.tar test 46 | tar zcvvf test.tgz test |qop test -m 47 | tar zxvvf test.tgz |qop -T `gzip -l test.tgz |sed -n '$s/\(.*\) \(.*\) .*/\2/p'` -tuntar -c 48 | tar zxvf test.tgz |qop -T `tar -zt = 0.2.2, you can omit -n and -s 59 | tar zcvvf test.tgz test |qop test [-m] 60 | tar zcvf test.tgz test |qop test ##no -m 61 | 62 | extracting a tar.gz file for new version(>=0.1.0): 63 | tar zxvvf test.tar.gz |qop -x test.tar.gz 64 | 65 | 66 | How To Compile: 67 | ------- 68 | 69 | 1.Desktop and Maemo: Just use QtCreator. 70 | 71 | 2.EZX: Use tmake. Or use my configure script. Type 72 | ./configure 73 | make 74 | make pkg 75 | More information about configue script can be got by ./configure --help 76 | -------------------------------------------------------------------------------- /config.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TARGET=qop-ezx 4 | PROJ=$TARGET.pro 5 | DESTDIR=bin 6 | MOC_DIR=.moc/ezx 7 | OBJECTS_DIR=.obj/ezx 8 | APPVERSION=0.2.8 9 | DEFINES=QT_THREAD_SUPPORT 10 | INCLUDE="src" 11 | LUPDATE=yes 12 | LIBSNEW= 13 | LIBDIRNEW= 14 | LANGS=zh-cn 15 | I18N_DIR=i18n 16 | 17 | -------------------------------------------------------------------------------- /config.pri: -------------------------------------------------------------------------------- 1 | #Copyright (C) 2011 Wang Bin 2 | #Shanghai, China. 3 | #GPL v2 4 | 5 | #CONFIG += ezx#static ezx 6 | CONFIG += profile 7 | #profiling, -pg is not supported for msvc 8 | debug:!*msvc*:profile { 9 | QMAKE_CXXFLAGS_DEBUG += -pg 10 | QMAKE_LFLAGS_DEBUG += -pg 11 | } 12 | 13 | #$$[TARGET_PLATFORM] 14 | #$$[QT_ARCH] #windows symbian windowsce arm 15 | PLATFORM_EXT = 16 | ARCH_EXT = 17 | TOOLCHAIN_EXT = 18 | unix { 19 | PLATFORM_EXT = _unix 20 | *linux*: PLATFORM_EXT = _linux 21 | *maemo*: PLATFORM_EXT = _maemo 22 | } else:win32 { 23 | PLATFORM_EXT = _win32 24 | } else:macx { 25 | PLATFORM_EXT = _macx 26 | } 27 | 28 | ezx { 29 | QT_VERSION = 2.3.8 30 | CONFIG += qt warn_on release 31 | DEFINES *= QT_THREAD_SUPPORT CONFIG_EZX 32 | PLATFORM_EXT = _ezx 33 | QMAKE_CXXFLAGS.ARMCC += 34 | } 35 | DEFINES *= QT_THREAD_SUPPORT 36 | #*arm*: ARCH_EXT = $${ARCH_EXT}_arm 37 | #isEqual(QT_ARCH, arm) { 38 | contains(QT_ARCH, arm.*) { 39 | ARCH_EXT = $${ARCH_EXT}_$${QT_ARCH} 40 | } 41 | *64: ARCH_EXT = $${ARCH_EXT}_x64 42 | *llvm*: TOOLCHAIN_EXT = _llvm 43 | #*msvc*: 44 | 45 | #before target name changed 46 | TRANSLATIONS += i18n/$${TARGET}_zh-cn.ts #i18n/$${TARGET}_zh_CN.ts 47 | 48 | #isEquel(var, value) is equals(var, value) in qt3 49 | contains(TEMPLATE, app) { 50 | DESTDIR = bin 51 | TARGET = $${TARGET}$${PLATFORM_EXT}$${ARCH_EXT}$${TOOLCHAIN_EXT} 52 | } 53 | else: DESTDIR = lib 54 | 55 | OBJECTS_DIR = .obj/$${PLATFORM_EXT}$${ARCH_EXT}$${TOOLCHAIN_EXT} 56 | #for Qt2, Qt3 which does not have QT_VERSION. Qt4: $$[QT_VERSION] 57 | MOC_DIR = .moc/$${QT_VERSION} 58 | RCC_DIR = .rcc/$${QT_VERSION} 59 | UI_DIR = .ui/$${QT_VERSION} 60 | 61 | #unix: QMAKE_POST_LINK=strip $(TARGET) 62 | !build_pass:message(target: $$DESTDIR/$$TARGET) 63 | -------------------------------------------------------------------------------- /configure: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ##auther wangbin 3 | #todo: destdir 4 | version=1.7.0 5 | show_help(){ 6 | cat <<_ACEOF 7 | \`configure' configures EZX programming project in simply. 8 | writed by wangbin. Version $version, 2011-06-19 9 | 10 | Usage: $0 [OPTION]... [VAR=VALUE]... 11 | 12 | Configuration: 13 | --help display this help and exit 14 | --version display version information and exit 15 | --target=TARGET app name to be created 16 | --destdir=DESTDIR app's dir 17 | --mocdir=MOC_DIR moc_xxx.cpp dir (defalut is .moc/ezx) 18 | --objdir=OBJECTS_DIR object dir (defalut is .obj/ezx) 19 | --pro=PROJ project name ( e.g. player.pro). default is the same as TARGET 20 | --appversion=APPVERSION app version to be write into TARGET.desktop 21 | --language+=langs append translations in project file to generare ts files. 22 | --i18ndir=I18N_DIR ts and qm files' dir. (default is i18n) 23 | --platform=[e6,a1200] Platform that this app support. default is e6. 24 | (.e.g. --language+=en-us.ts,zh-cn.ts). zh-cn is default. 25 | --lupdate=[yes,no] run lupdate when after run make. default is yes 26 | --lib+=LIBADD add LIBADD in Make file. ( .e.g --lib+=jpeg 27 | or mutil-libs like --lib+=jpeg,png ) 28 | --libdir+=LIBDIR add lib dirs 29 | --incdir+=INCDIR add include dirs (e.g. --incdir+=libjpeg,libmad) 30 | --def+=DEF 31 | 32 | WARBING: dir can not contain "/" in this version 33 | _ACEOF 34 | 35 | exit 36 | } 37 | 38 | ##setup default value 39 | sed -i "s/\(^LUPDATE=\).*/\1yes/" config.in 40 | 41 | ##load the vars 42 | . ./config.in 43 | oldproj=$PROJ 44 | olddest=$TARGET 45 | langs=$LANGS 46 | addedlibs=$LIBSNEW 47 | addedlibdirs=$LIBDIRNEW 48 | addedincdirs=$INCLUDE 49 | adddefs=$DEFINES 50 | platform= 51 | 52 | ##parse the arguments 53 | for opt in $@ 54 | do 55 | [ -z $optset ] && optset=`expr "$opt" : '\(.*\)=.*'` 56 | [ -z $optset ] && optset=$opt && optarg=yes 57 | 58 | case $opt in 59 | *=*) 60 | optarg=`expr "X$opt" : '[^=]*=\(.*\)'` 61 | ;; 62 | esac 63 | 64 | ## echo $optset 65 | case $optset in 66 | --target) 67 | sed -i "s/\(^TARGET=\).*/\1$optarg/" config.in 68 | ;; 69 | 70 | --destdir) 71 | sed -i "s/\(^DESTDIR=\).*/\1$optarg/" config.in 72 | ;; 73 | 74 | --mocdir) 75 | sed -i "s/\(^MOC_DIR=\).*/\1$optarg/" config.in 76 | ;; 77 | 78 | --objdir) 79 | sed -i "s/\(^OBJECTS_DIR=\).*/\1$optarg/" config.in 80 | ;; 81 | 82 | --pro) 83 | sed -i "s/\(^PROJ=\).*/\1$optarg/" config.in 84 | ;; 85 | 86 | --appversion) 87 | sed -i "s/\(^APPVERSION=\).*/\1$optarg/" config.in 88 | ;; 89 | 90 | --lib+) 91 | addedlibs=$addedlibs,$optarg 92 | ;; 93 | 94 | --libdir+) 95 | [ -z $addedlibdirs ] && addedlibdirs=$optarg || addedlibdirs="$addedlibdirs,$optarg" 96 | ;; 97 | 98 | --incdir+) 99 | addedincdirs="$addedincdirs,$optarg" 100 | ;; 101 | 102 | --def+) 103 | [ -z $adddefs ] && adddefs=$optarg ||adddefs="$adddefs,$optarg" 104 | ;; 105 | 106 | --language+) 107 | [ -z $LANGS ] && addedlangs=$optarg ||addedlangs=$addedlangs,$optarg 108 | echo $addedlangs 109 | langs="$langs,$addedlangs" 110 | sed -i "s/\(^LANGS=\).*/\1$addedlangs/" config.in 111 | ;; 112 | --i18ndir) 113 | sed -i "s/\(^I18N_DIR=\).*/\1$optarg/" config.in 114 | ;; 115 | --lupdate) 116 | sed -i "s/\(^LUPDATE=\).*/\1$optarg/" config.in 117 | ;; 118 | 119 | --help) 120 | show_help 121 | ;; 122 | 123 | --version) 124 | echo configure Version: "$version" 125 | exit 126 | ;; 127 | 128 | --platform) 129 | platform=$optarg 130 | sed -i "s/\(^PLATFORM=\).*/\1$optarg/" config.in 131 | ;; 132 | 133 | --lib) 134 | addedlibs=$optarg 135 | ;; 136 | 137 | --language) 138 | addedlangs=$optarg 139 | langs=$addedlangs 140 | sed -i "s/\(^LANGS=\).*/\1$addedlangs/" config.in 141 | ;; 142 | 143 | esac 144 | optset= 145 | done 146 | 147 | 148 | ##load vars again 载入变量 149 | . ./config.in 150 | 151 | 152 | rm -f `find ./ -name \*~` 153 | 154 | 155 | ###global setting header file for the project -f needed 156 | :<>config.h<>mpkg/$TARGET/$TARGET.desktop<>$PROJ 218 | [ -z $MOC_DIR ] && MOC_DIR=.moc/ezx 219 | echo "MOC_DIR = $MOC_DIR" 220 | echo "MOC_DIR = $MOC_DIR" >>$PROJ 221 | [ -z $OBJECTS_DIR ] && OBJECTS_DIR=.obj/ezx 222 | echo "OBJECTS_DIR = $OBJECTS_DIR" 223 | echo "OBJECTS_DIR = $OBJECTS_DIR" >>$PROJ 224 | #echo "added defs are: " $adddefs 225 | if [ ! -z $adddefs ];then 226 | adddefs=`echo $adddefs |sed 's/,/ /g'` 227 | echo adding defines... $adddefs 228 | echo DEFINES += $adddefs >>$PROJ 229 | fi 230 | if [ ! -z $addedincdirs ];then 231 | addedincdirs=`echo $addedincdirs |sed 's/,/ -I/g'` 232 | echo adding include dirs... $addedincdirs 233 | echo INCLUDEPATH += $addedincdirs >>$PROJ 234 | fi 235 | 236 | if [ ! -z $addedlibs ];then 237 | addedlibs=`echo -l$addedlibs |sed 's/,/ -l/g'` 238 | echo adding librarys... $addedlibs 239 | [ ! -z $addedlibdirs ] && addedlibdirs=`echo -L$addedlibdirs |sed 's/,/ -L/g'` && echo adding library dirs... $addedlibdirs 240 | echo LIBS += $addedlibdirs $addedlibs >>$PROJ 241 | fi 242 | 243 | 244 | ##echo TRANSLATIONS += $TARGET"_zh-cn.ts" >>$PROJ 245 | ##[ -n $addedlangs ] is wrong 246 | 247 | echo adding languages... 248 | langs=`echo $I18N_DIR\/$TARGET\_$langs |sed "s/,/\.ts $I18N_DIR\/$TARGET"_"/g"` 249 | langs=$langs\.ts 250 | echo $langs 251 | echo TRANSLATIONS += $langs >>$PROJ 252 | #echo TRANSLATIONS += $TARGET"_zh-cn.ts" $TARGET"_zh-hk.ts" $addedlangs >>$PROJ 253 | :<>Makefile<>Makefile< Thu, 14 Apr 2011 10:08:20 +0800 7 | 8 | Auther: Wang Bin (aka nukin in ccomve & novesky in motorolafans) 9 | Shanghai university, China 10 | 2010-09-09 11 | wbsecg1@gmail.com 12 | Other links: http://sourceforge.net/projects/qop/files" 13 | http://qt-apps.org/content/show.php/qop?content=132430 14 | 15 | Qt Output Parser for tar, zip, unzip, unrar, 7z with a compression/extraction progress indicator. 16 | Support platforms: windows(Qt4), Linux(Qt4, tested on ubuntu 10.04), motorola ezx(Qt2, tested on ROKR E6) and Maemo5 etc. 17 | 18 | bug: can't kill 7z in windows. 19 | 20 | Usage: qop [-t parserFor] [-n|s] [-chm] [-x archieve|-T totalSteps] [files...] 21 | 22 | -m, --multi-thread: create a new thread to calculate progress bar's total steps. 23 | -h, --help: help 24 | -n, --number: set number of files as total steps. 25 | -s, --size: set size of files as total steps. -s is default 26 | -T, --steps=STEPS: specify total steps. 27 | -t, --parser[=TYPE]: usually is tool's name, such as tar, zip, unzip, unrar. If using xz, lzop etc with tar, parser is tar. -t tar is default. 28 | If you want to extract a .tar or .tar.xxx file and set size as total steps, use -tuntar is better. 29 | -x, --exteact=ARCHIVE: extracting mode. Omit -T argument. Analyze parser and total steps automaticly. 30 | -o, --outdir=dir: set the output dir when using internal extract method(qop -d -x test.tar -o outdir) 31 | -c, --auto-close: auto close when finished 32 | -C, --cmd=command: execute command 33 | -d, --diy[=TARFILE]: using built-in method to extract an archive 34 | 35 | examples: 36 | qop -C zip -ryv -9 test.zip test 37 | qop -C zip -ry -9 test.zip test 38 | qop -C unzip -o test.zip -d exdir 39 | qop -C unrar x -o+ -p- -y rar.rar destdir 40 | qop -C tar cvvf test.tar test 41 | qop -C tar zcvf test.tgz test 42 | qop -C tar zxvvf test.tgz -C /tmp ##only 1 v will not show the right totalsteps and progress 43 | qop tar cvvf test.tar test 44 | tar zcvvf test.tgz test |qop test -m 45 | tar zxvvf test.tgz |qop -T `gzip -l test.tgz |sed -n '$s/\(.*\) \(.*\) .*/\2/p'` -tuntar -c 46 | tar zxvf test.tgz |qop -T `tar -zt = 0.2.2, you can omit -n and -s 57 | tar zcvvf test.tgz test |qop test [-m] 58 | tar zcvf test.tgz test |qop test ##no -m 59 | 60 | extracting a tar.gz file for new version(>=0.1.0): 61 | tar zxvvf test.tar.gz |qop -x test.tar.gz 62 | 63 | 64 | How To Compile: 65 | 1.Desktop and Maemo: Just use QtCreator. 66 | 2.EZX: Use tmake. Or use my configure script. Type 67 | ./configure 68 | make 69 | make pkg 70 | More information about configue script can be got by ./configure --help 71 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | qop (0.3.5) stable; urgency=low 2 | * 3 | 4 | -- Wang Bin 周五, 23 九月 2011 19:53:06 +0800 5 | 6 | qop (0.3.5) stable; urgency=low 7 | 8 | * Add uncomplete zip, unzip, unrar support for -C option. See help-en_US.txt. 9 | 10 | -- Wang Bin Thu, 19 Apr 2011 21:41:55 +0800 11 | 12 | * Initial Release. 13 | 14 | -- Wang Bin Thu, 14 Apr 2011 10:08:20 +0800 15 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: qop 2 | Section: user/hidden 3 | Priority: optional 4 | Maintainer: Wang Bin 5 | Build-Depends: debhelper (>= 5) 6 | Standards-Version: 3.7.3 7 | Homepage: 8 | 9 | Package: qop 10 | Architecture: any 11 | Depends: 12 | Description: A compression/extraction progress indicator 13 | A compression/extraction progress indicator for tar, zip, unzip, unrar, 7z by parsing their output message. It has a simple 14 | built-in method to unpack tar files. 15 | Support platforms: windows(Qt4), Linux(Qt4, tested on ubuntu 10.10), motorola ezx(Qt2, tested on ROKR E6) and Maemo5 etc. 16 | Latest release: https://sourceforge.net/projects/qop/files/ 17 | http://qt-apps.org/content/show.php/qop?content=132430 18 | XB-Maemo-Icon-26: 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 19 | XB-Maemo-Display-Name: qop 20 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by Wang Bin on 2 | Thu, 14 Apr 2011 10:08:20 +0800. 3 | 4 | It was downloaded from 5 | 6 | Upstream Author(s): 7 | 8 | 9 | 10 | 11 | Copyright: 12 | 13 | 14 | 15 | 16 | License: 17 | 18 | This package is free software; you can redistribute it and/or modify 19 | it under the terms of the GNU General Public License as published by 20 | the Free Software Foundation; either version 2 of the License, or 21 | (at your option) any later version. 22 | 23 | This package is distributed in the hope that it will be useful, 24 | but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | GNU General Public License for more details. 27 | 28 | You should have received a copy of the GNU General Public License 29 | along with this package; if not, write to the Free Software 30 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 31 | 32 | On Debian systems, the complete text of the GNU General 33 | Public License can be found in `/usr/share/common-licenses/GPL'. 34 | 35 | The Debian packaging is (C) 2011, Wang Bin and 36 | is licensed under the GPL, see above. 37 | 38 | 39 | # Please also look if there are files or directories which have a 40 | # different copyright/license attached and list them here. 41 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # This file was originally written by Joey Hess and Craig Small. 5 | # As a special exception, when this file is copied by dh-make into a 6 | # dh-make output file, you may use that output file without restriction. 7 | # This special exception was added by Craig Small in version 0.37 of dh-make. 8 | 9 | # Uncomment this to turn on verbose mode. 10 | #export DH_VERBOSE=1 11 | 12 | 13 | 14 | 15 | 16 | configure: configure-stamp 17 | configure-stamp: 18 | dh_testdir 19 | # Add here commands to configure the package. 20 | 21 | touch configure-stamp 22 | 23 | 24 | build: build-stamp 25 | 26 | build-stamp: configure-stamp 27 | dh_testdir 28 | 29 | # Add here commands to compile the package. 30 | $(MAKE) 31 | #docbook-to-man debian/qop.sgml > qop.1 32 | 33 | touch $@ 34 | 35 | clean: 36 | dh_testdir 37 | dh_testroot 38 | rm -f build-stamp configure-stamp 39 | 40 | # Add here commands to clean up after the build process. 41 | $(MAKE) clean 42 | 43 | dh_clean 44 | 45 | install: build 46 | dh_testdir 47 | dh_testroot 48 | dh_clean -k 49 | dh_installdirs 50 | 51 | # Add here commands to install the package into debian/qop. 52 | $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/qop install 53 | 54 | 55 | # Build architecture-independent files here. 56 | binary-indep: build install 57 | # We have nothing to do by default. 58 | 59 | # Build architecture-dependent files here. 60 | binary-arch: build install 61 | dh_testdir 62 | dh_testroot 63 | dh_installchangelogs 64 | dh_installdocs 65 | dh_installexamples 66 | # dh_install 67 | # dh_installmenu 68 | # dh_installdebconf 69 | # dh_installlogrotate 70 | # dh_installemacsen 71 | # dh_installpam 72 | # dh_installmime 73 | # dh_python 74 | # dh_installinit 75 | # dh_installcron 76 | # dh_installinfo 77 | dh_installman 78 | dh_link 79 | # dh_strip 80 | dh_compress 81 | dh_fixperms 82 | # dh_perl 83 | # dh_makeshlibs 84 | dh_installdeb 85 | dh_shlibdeps # Uncomment this line for publishing! 86 | dh_gencontrol 87 | dh_md5sums 88 | dh_builddeb 89 | 90 | binary: binary-indep binary-arch 91 | .PHONY: build clean binary-indep binary-arch binary install configure 92 | -------------------------------------------------------------------------------- /doc/TODO.txt: -------------------------------------------------------------------------------- 1 | branch 0.4: 2 | libqop 3 | 4 | 5 | VERSION 0.3 TODO List 6 | 7 | 8 | complete command parser and move option values into 1 class containing those static vars; 9 | 10 | QTextBrowser for log viewing intergrated into EZProgressDialog 11 | 12 | Add qmake for qt3 and mkspecs etc 13 | 14 | QProcess controller. stop/resume 15 | Lzma 16 | add long option only, --time-format, --size --count --unit=size|count 17 | 18 | UI: 19 | 1:(boost.any like) 20 | we can reuse ezprogressdialog without any change 21 | { 22 | template 23 | ProgressUI(T* ui) 24 | .. 25 | interfaces {hoder->interfaces} 26 | .. 27 | class HolderBase { 28 | interfaces = 0; 29 | } 30 | template class Holder ::public HolderBase 31 | { 32 | interfaces 33 | } 34 | private: 35 | HolderBase *holder; 36 | } 37 | 38 | 2: OPP 39 | AbstractProgress 40 | subclasses=> 41 | PrpgressCLI, ProgressGUI 42 | 43 | 44 | Parser: none-qobject like object, remove signals, ProgressUI instead (QThread is a problem) 45 | 46 | 47 | VERSION 0.2 TODO List 48 | 49 | QSocketNotifier is suck! 50 | 51 | -T does not work 52 | 53 | //todo use windows api get dir 54 | BUG: EZProgressDialog::resizeButtons() is called for many times 55 | Profiling 56 | 减少QString::operator+(), add macros for msg, extra_msg, using QString().sprintf()// or QString::arg() return & 57 | 58 | KArchive 59 | in another program: 60 | compressProcess->setOutputProcess(qopProcess) 61 | connect(qopProcess, SIGNAL(finished(int, QProcess::ExitStatus)), compressProcess, SLOT(terminate())); 62 | //terminate() gui on windows 63 | connect(qopProcess, SIGNAL(finished(int, QProcess::ExitStatus)), compressProcess, SLOT(kill())); 64 | 65 | 66 | Qt2 QThread 67 | ezlog 68 | Like 7zG, Show Dir and filename in seperated lines 69 | 70 | 文档,使用说明 71 | Help system 72 | Test scripts 73 | 74 | QArchiveInfo :QFileInfo 75 | callBack 76 | 77 | QTextBrowser: error viewer 78 | 79 | EZProgressDialog Q_D() etc 80 | 81 | QSocket 对qop与qprocess间进行通信。 82 | EZProgressDialog::socket() 83 | 84 | Error Handler 85 | Port Qt4 QProcess to Qt2 Qt3 86 | read all stdout then parse line by line 87 | or read all then parse the last line 88 | internal tar Chinese support, QProcess env 89 | 90 | file permisson 91 | 92 | FIXME: 93 | -C command: sometimes taroutparser unit error 94 | 95 | libqop.so 96 | 97 | Using QProcess: 98 | QByteArray data = qprocess->readAllStandardOutput(); 99 | QString line = data.constData(); 100 | 101 | qop->parseLine(line); 102 | 103 | QSocketNotifier 104 | QProcess::terminate() in filemanager 105 | 106 | 107 | ////////////////////////////////////////////////////////////////// 108 | 109 | function ptr replace signal/slot, use macros 110 | 111 | qt2.x 3.x线程间无法进行signal-slot消息传递,导致各消息循环相独立的loop, 通讯的唯一方式global state+ mutex lock 112 | 113 | Change macros to typedef! 114 | 115 | ISO Edit (ISOMaster) 116 | Archieve Mounter 117 | 118 | Endian: busybox/include/platform.h 119 | kill 7z in Windows 120 | read archieve header 121 | built-in untar 122 | check password by reading file header 123 | Testing scripts 124 | build shared library qopCui.so 125 | operate on stream 126 | 127 | support both STL and Qt 128 | Finish message 129 | 130 | program options: -stdin -stdout - --verbose 131 | 132 | template QOutParser 133 | pthread instead of QThread 134 | 135 | //#define TEST_MYOPT 0 136 | #if TEST_MYOPT 137 | typedef void* (*do_func)(); 138 | enum ArgumentFlag { 139 | NoArgument=0,RequiredArgument,OptinalArgument 140 | }; 141 | 142 | struct QOptionsPrivate 143 | { 144 | const char* long_opt; 145 | char opt; 146 | QAny value; 147 | ArgumentFlag arg_flag; 148 | const char* description; 149 | do_func func_ptr; 150 | 151 | }; 152 | 153 | class QOptions 154 | { 155 | public: 156 | QOptions(int argc,char** argv); 157 | ~QOptions(); 158 | 159 | QOptions& operator()(const char* name,const QAny& value,const char* description=0); 160 | QOptions& operator()(const char* name,const char* description=0); 161 | QAny& operator[](const char* name); 162 | 163 | void readCommand(int argc,char** argv); 164 | void doOptions(); 165 | 166 | private: 167 | QList opts, opts_in; 168 | 169 | }; 170 | #endif //TEST_MYOPT 171 | /*! 172 | 173 | TODO: 174 | -v --verbose 175 | stderr 176 | input password 177 | tar cvf: count the number of files, also estimate left time, speed files/s--------------X 178 | need 1 more timer to estimate when time out----------------------------------------------X 179 | display size/number left----------------------------------------------X 180 | consol mode 181 | 182 | _out="

"+file+"

"+tr("Size: ")+size2str(size) \ 183 | +"
"+tr("Processed: ")+size2str(value)+" / "+max_str+"
"; 184 | Rich text takes much more time 185 | 186 | 187 | Format --> TarVerbose TarQuite ... EndZip 7zEnd 188 | 189 | 7z l archieve 190 | 7z counts files exclude dirs----------------------------------------------X 191 | kill 7z 192 | 193 | Processed: files/files----------------------------------------------X 194 | 195 | 196 | template 197 | class OutputFormat { 198 | OutputFormat() {map_addr()]; 199 | const char* fmt, 200 | char *keyword[16]; 201 | T1 argv1; 202 | T2 argv2; 203 | T3 argv3; 204 | 205 | map_addr(void* ptr1,void* ptr2,void* ptr3);//T1, T2, T3-->&size,name,rate 206 | } 207 | 208 | 209 | //QMap 210 | 211 | getParser(const QString&) { 212 | new QOutParser 213 | //ref to boost.any 214 | setOutputFormat() 215 | } 216 | 217 | parse() 218 | 219 | class LineFormat { 220 | public: 221 | virtual ~LineFormat()=0; 222 | char* format; 223 | QStringList keyword, keyword_unkown; 224 | QString keyword_err; 225 | } 226 | 227 | template 228 | class LineFormatArc :public LineFormat { 229 | void map_addr(T1* ptr1,T2* ptr2,T3* ptr3) { 230 | argv1=ptr1,argv2=ptr2,argv3=ptr3; 231 | } 232 | private: 233 | T1 argv1; //ptr 234 | T2 argv2; 235 | T3 argv3; 236 | 237 | } 238 | 239 | 240 | class QOutParser { 241 | ... 242 | private: 243 | char name[256], r[8]; 244 | int s; 245 | LineFormat *line_fmt; 246 | } 247 | 248 | QOutParser::setLineFormat(const QString& type) 249 | { 250 | if(type=="tar") { line_fmt=new LineFormatArc();lf.map_addr(*s,name,null); 251 | keyword<<""<<...;} 252 | ... 253 | 254 | } 255 | 256 | QOutParser::parse() { 257 | bool kw_found=false; 258 | it //keyword 259 | for(it) { 260 | if(line.contains(*it) {kw_found=true;break;} 261 | } 262 | if(!kw_found) return Unknow; 263 | else { fprintf(line,line_fmt.format,line_fmt.argv1...); 264 | file=... 265 | ... 266 | } 267 | } 268 | 269 | main.cpp: 270 | QOutParser *qop=new QOutParser; 271 | qop->setFormat(type); 272 | 273 | qop->parse() 274 | 275 | 276 | */ 277 | GUI: 278 | 1.mark items to remove/extract 279 | 2.7z Gui. Use 7z lib directly! 280 | 281 | 282 | -------------------------------------------------------------------------------- /doc/help-en_US.txt: -------------------------------------------------------------------------------- 1 | Auther: Wang Bin (aka nukin in ccomve & novesky in motorolafans) 2 | Shanghai university, China 3 | 2010-09-09 4 | wbsecg1@gmail.com 5 | Project: 6 | https://github.com/wang-bin/qop 7 | http://sourceforge.net/projects/qop/files" 8 | http://qt-apps.org/content/show.php/qop?content=132430 9 | 10 | Qt Output Parser for tar, zip, unzip, unrar, 7z with a compression/extraction progress indicator. 11 | Support platforms: windows(Qt4), Linux(Qt4, tested on ubuntu 10.04), motorola ezx(Qt2, tested on ROKR E6) and Maemo5 etc. 12 | 13 | bug: can't kill 7z in windows. 14 | 15 | usage: qop [-interval=Nunit] [--all] [-t parserFor] [-n|s] [-chm] [-x archieve|-T totalSteps] [files...] 16 | -a, --all: update all changes. default is update on timer event 17 | -F, --time-format=fmt: setup time format. utc(iso8601) or normal 18 | -i, --interval=Nunit: update the progress every N seconds/mseconds. unit can be s, sec[s],seconds(N can be float) or msec[s](N is int) 19 | -m, --multi-thread: create a new thread to calculate progress bar's total steps. 20 | -h, --help: help 21 | -n, --number: set number of files as total steps. 22 | -s, --size: set size of files as total steps. -s is default 23 | -T, --steps=STEPS: specify total steps. 24 | -t, --parser[=TYPE]: usually is tool's name, such as tar, zip, unzip, unrar. If using xz, lzop etc with tar, parser is tar. -t tar is default. 25 | If you want to extract a .tar or .tar.xxx file and set size as total steps, use -tuntar is better. 26 | -x, --exteact=ARCHIVE: extracting mode. Omit -T argument. Analyze parser and total steps automaticly. 27 | -o, --outdir=dir: set the output dir when using internal extract method(qop -d -x test.tar -o outdir) 28 | -c, --auto-close: auto close when finished 29 | -C, --cmd=command: execute command 30 | -d, --diy[=TARFILE]: using built-in method to extract an archive 31 | 32 | examples: 33 | qop -C zip -ryv -9 test.zip test 34 | qop -C zip -ry -9 test.zip test 35 | qop -C unzip -o test.zip -d exdir 36 | qop -C unrar x -o+ -p- -y rar.rar destdir 37 | qop -C tar cvvf test.tar test 38 | qop -C tar zcvf test.tgz test 39 | qop -C tar zxvvf test.tgz -C /tmp ##only 1 v will not show the right totalsteps and progress 40 | qop tar cvvf test.tar test 41 | tar zcvvf test.tgz test |qop test -m 42 | tar zxvvf test.tgz |qop -T `gzip -l test.tgz |sed -n '$s/\(.*\) \(.*\) .*/\2/p'` -tuntar -c 43 | tar zxvf test.tgz |qop -T `tar -zt = 0.2.2, you can omit -n and -s 54 | tar zcvvf test.tgz test |qop test [-m] 55 | tar zcvf test.tgz test |qop test ##no -m 56 | 57 | extracting a tar.gz file for new version(>=0.1.0): 58 | tar zxvvf test.tar.gz |qop -x test.tar.gz 59 | 60 | 61 | How To Compile: 62 | 1.Desktop and Maemo: Just use QtCreator. 63 | 2.EZX: Use tmake. Or use my configure script. Type 64 | ./configure 65 | make 66 | make pkg 67 | More information about configue script can be got by ./configure --help 68 | 69 | -------------------------------------------------------------------------------- /doc/help-zh_CN.txt: -------------------------------------------------------------------------------- 1 | Auther: Wang Bin (aka nukin in ccomve & novesky in motorolafans) 2 | Shanghai university, China 3 | 2010-09-09 4 | wbsecg1@gmail.com 5 | 6 | 软件名:qop. Qt Output Parser for tar, zip, unzip, unrar,7z with compressing/extracting progress indicator. 7 | 用于显示tar,zip,unzip,unrar,7z这些工具进行压缩解压时的进度,与tar结合使用的工具如gzip,xz等也可以处理。 8 | 平台支持:windows(Qt4), Linux(Qt4, tested on ubuntu 10.04), motorola ezx(Qt2, tested on ROKR E6)和Maemo5等 9 | 10 | Project: 11 | https://github.com/wang-bin/qop 12 | http://sourceforge.net/projects/qop/files" 13 | http://qt-apps.org/content/show.php/qop?content=132430 14 | 15 | 原理:其实就是分析压缩解压工具的终端输出来计算进度并对其他量进行估计。暂时没有想到更好的办法。 16 | 缺点:当前显示的是之前一个文件处理完毕时的信息,而不是正在处理的文件的信息。没办法,因为是读取一行输出后才进行显示。无法与终端进行交互 17 | bug: windows 下取消后7z进程无法结束 18 | 19 | usage: qop [-interval=Nunit] [--all] [-t parserFor] [-n|s] [-chm] [-x archieve|-T totalSteps] [files...] 20 | -a, --all: 立即更新所有压缩解压信息。默认为定时器时间间隔到了更新。 21 | -F, --time-format=fmt: 设置时间显示格式. utc(iso8601) 或 normal 22 | -i, --interval=Nunit: 每N(豪)秒更新一次进度. unit可以是 s, sec[s],seconds(N可以为小数)或msec[s](N为整数) 23 | -m, --multi-thread: 另开一个进程来计算进度条总步长. 24 | -h, --help: help 25 | -n, --number: 设置总步长为文件数. 26 | -s, --size: 设置总步长为文件大小(默认). 27 | -T, --steps=STEPS: 设置总步长值. 28 | -t, --parser[=TYPE]: 通常为压缩解压工具的名字, 如tar, zip, unzip, unrar. 如果xz, lzop等结合tar使用, parser为tar. 缺省值 -t tar 29 | 若要解压tar或tar.xxx文件, 建议使用-tuntar. 30 | -x, --exteact=ARCHIVE: 解压缩. 忽略-T选项, 自动分析parser和总步长, 即无需-t选项. 31 | -o, --outdir=dir: 使用内置解压时设置输出目录为dir(qop -d -x test.tar -o outdir) 32 | -c, --auto-close: 处理完毕自动关闭窗口 33 | -C, --cmd=command: 运行command命令 34 | -d, --diy[=TARFILE]: 使用自带的方法解压 35 | 36 | 37 | 例子: 38 | qop -C zip -ryv -9 test.zip test 39 | qop -C zip -ry -9 test.zip test 40 | qop -C unzip -o test.zip 41 | qop -C unrar x -o+ -p- -y rar.rar destdir 42 | qop -C tar cvvf test.tar test 43 | qop -C tar zcvf test.tgz test 44 | qop -C tar zxvvf test.tgz -C /tmp ## 只有一个v会导致进度显示错误 45 | tar zcvvf test.tgz test |qop test -m 46 | tar zxvvf test.tgz |qop -T `gzip -l test.tgz |sed -n '$s/\(.*\) \(.*\) .*/\2/p'` -tuntar -c 47 | tar zxvf test.tgz |qop -T `tar -zt = 0.2.2, 可以省略 -n 和 -s 60 | tar zcvvf test.tgz test |qop test [-m] 61 | tar zcvf test.tgz test |qop test ##不要 -m 62 | 63 | 新版(版本>=0.1.0)的解压tar.gz文件例子: 64 | tar zxvvf test.tgz test |qop -x test.tgz 65 | 66 | 67 | 如何编译: 68 | 1.桌面或Maemo: 使用QtCreator 69 | 2.EZX: 使用tmake或我写的configure脚本。输入 70 | ./configure 71 | make 72 | make pkg 73 | configure更多的使用方法请./configure --help 74 | 75 | 大家觉得好用的话给我的qt-apps project点下good! thx! 76 | -------------------------------------------------------------------------------- /doc/history: -------------------------------------------------------------------------------- 1 | =====================================2011======================================= 2 | 04-19: 3 | -C option supports zip, unzip, unrar. 4 | 5 | 6 | 04-18: 7 | QOutParser only change unit without recount total steps when use -x option. 8 | move steps calculation from Option to Qop to reduce dependency. 9 | Fix tar extracting progress when using -C option 10 | 11 | 04-17: 12 | You can just omit the -s and -n like the following: 13 | tar zcvvf test.tgz test |qop test -m 14 | tar zcvvf test.tgz test |qop test -m 15 | because i calculate the frequency of the unit when analyzing the output message 16 | Pause button is checkable. 17 | Show approximate total steps, progress using -C option for tar. Also can get correct number/size of archive and files with -C option. 18 | (check vv or v, c or x) 19 | 20 | 04-16: 21 | show the correct total steps when compressing use -C option. filter out the symlinks. 22 | New: -o, --outdir=dir. set output dir when using internal extracting method 23 | QString::fromLocal8Bit(cstr) to have a right decoder. File name can be show correctly 24 | Pause button is checkable 25 | 26 | 04-12: 27 | size2Str to size2Str 28 | ~Qop() 29 | add macro: QFILENAME and replace QFileinfo::fileName() 30 | 31 | 04-11: Version 0.1.6 32 | new: qop -C|--cmd commad (e.g. qop -C tar zxvf test.tgz) 33 | bug: can't show correct progress 34 | =====================================2010======================================= 35 | 11-27: 36 | auto detect tar output message format and determin the right unit in single thread mode. 37 | 38 | 10-02: 39 | new classes: QArchive, QTar 40 | support extract tar archive using: qop -d -x test.tar or qop -dtest.tar or qop --diy=test.dir 41 | TODO: complete tar functions 42 | pause and continue 43 | read from stdin and write to stdout 44 | 45 | 10-01: 46 | long options support 47 | 48 | 09-26: 49 | ezprogressdialog print labelText() to stdout without return when hidden; 50 | 51 | 09-23: 52 | detect format by reading header 53 | add [-x archive] option. 54 | add QArcReader as alternative 55 | add lha detect 56 | 57 | 09-22: 58 | add class ArcReader to get uncompressed size by reading the archieve. Using std c++; 59 | -x x_file option 60 | 61 | 09-17: 62 | version 0.0.4 63 | show dialog with text "Calculating..." while counting without multi-thread support. 64 | change dialog title 65 | add class QUntarOutParser to indicate extraction progress exactly when extracting a .tar and .tar.xxx file. need -tuntar option. 66 | 67 | 09-15: 68 | version 0.0.2 69 | 7z support 70 | in number mode displaying speed, remaining time 71 | and other 72 | -------------------------------------------------------------------------------- /i18n.pri: -------------------------------------------------------------------------------- 1 | #rules to generate ts 2 | isEmpty(QMAKE_LUPDATE) { 3 | win32: QMAKE_LUPDATE = $$[QT_INSTALL_BINS]/lupdate.exe 4 | unix { 5 | QMAKE_LUPDATE = $$[QT_INSTALL_BINS]/lupdate 6 | !exists($$QMAKE_LUPDATE) { QMAKE_LUPDATE = lupdate-qt4 } 7 | } else { 8 | !exists($$QMAKE_LUPDATE) { QMAKE_LUPDATE = lupdate } 9 | } 10 | } 11 | #limitation: only on ts can be generated 12 | updatets.input = _PRO_FILE_ 13 | updatets.output = $$TRANSLATIONS 14 | updatets.commands = $$QMAKE_LUPDATE ${QMAKE_FILE_IN} 15 | updatets.CONFIG += no_link no_clean#target_predeps 16 | QMAKE_EXTRA_COMPILERS += updatets 17 | 18 | #rules for ts->qm 19 | isEmpty(QMAKE_LRELEASE) { 20 | #a qm generated by lrelease-qt3 can be used for qt2, qt3, qt4! 21 | win32: QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease.exe 22 | unix { 23 | QMAKE_LRELEASE = lrelease-qt3 24 | !exists($$QMAKE_LRELEASE) { QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease } 25 | !exists($$QMAKE_LRELEASE) { QMAKE_LRELEASE = lrelease } 26 | !exists($$QMAKE_LRELEASE) { QMAKE_LRELEASE = lrelease-qt4 } 27 | } else { 28 | !exists($$QMAKE_LRELEASE) { QMAKE_LRELEASE = lrelease } 29 | } 30 | } 31 | updateqm.input = TRANSLATIONS 32 | updateqm.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.qm 33 | updateqm.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.qm 34 | updateqm.CONFIG += no_link no_clean target_predeps 35 | QMAKE_EXTRA_COMPILERS += updateqm 36 | #PRE_TARGETDEPS += compiler_updateqm_make_all #will always link 37 | -------------------------------------------------------------------------------- /i18n/qop-zh_CN.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang-bin/qop/3b92c57b1e8289e7e3b61d8287b4f2ad56687792/i18n/qop-zh_CN.qm -------------------------------------------------------------------------------- /i18n/qop_zh-cn.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang-bin/qop/3b92c57b1e8289e7e3b61d8287b4f2ad56687792/i18n/qop_zh-cn.qm -------------------------------------------------------------------------------- /i18n/qop_zh-cn.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Archive::QArchive 6 | 7 | Calculating... 8 | 正在计算... 9 | 10 | 11 | 12 | EZProgressDialog 13 | 14 | EZProgressDialog 15 | EZProgressDialog 16 | 17 | 18 | 19 | QObject 20 | 21 | (De)Compress Indicator 22 | (解)压缩指示器 23 | 24 | 25 | Cancel 26 | 取消 27 | 28 | 29 | Hide 30 | 隐藏 31 | 32 | 33 | Compression/Extraction progress dialog 34 | 压缩解压对话框 35 | 36 | 37 | Size: 38 | 大小: 39 | 40 | 41 | Processed: 42 | 已处理: 43 | 44 | 45 | Speed: 46 | 速度: 47 | 48 | 49 | Elapsed: %1s Remaining: %2s 50 | 用时: %1s 剩余: %2s 51 | 52 | 53 | Finished: 54 | 已完成: 55 | 56 | 57 | files 58 | 个文件 59 | 60 | 61 | Calculating... 62 | 正在计算... 63 | 64 | 65 | Pause 66 | 暂停 67 | 68 | 69 | Ratio: 70 | 压缩率: 71 | 72 | 73 | 74 | QOutParser 75 | 76 | Elapsed: %1s Remaining: %2s 77 | 用时: %1s 剩余: %2s 78 | 79 | 80 | Size: 81 | 大小: 82 | 83 | 84 | Processed: 85 | 已处理: 86 | 87 | 88 | Speed: 89 | 速度: 90 | 91 | 92 | Elapsed: %1s Processed: %2 files 93 | 用时: %1s 已处理: %2 个文件 94 | 95 | 96 | Ratio: 97 | 压缩率: 98 | 99 | 100 | Password Error! 101 | 密码错误! 102 | 103 | 104 | Finished: 105 | 已完成: 106 | 107 | 108 | files 109 | 个文件 110 | 111 | 112 | Elapsed time: 113 | 用时: 114 | 115 | 116 | Compressed: 117 | 已压缩: 118 | 119 | 120 | Compression ratio: 121 | 压缩率: 122 | 123 | 124 | Calculating... 125 | 正在计算... 126 | 127 | 128 | Counting... 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /qop.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | TARGET = qop 3 | INCLUDEPATH += src 4 | LIBS += #-Llib -lz 5 | FORMS = 6 | 7 | include(config.pri) 8 | include(i18n.pri) 9 | 10 | ezx: DEFINES += QT_NO_PROCESS 11 | 12 | HEADERS += src/QOutParser.h \ 13 | src/gui/ezprogressdialog.h \ 14 | src/gui/ezprogressdialog_p.h \ 15 | src/qcounterthread.h \ 16 | src/qarchive/arcreader.h \ 17 | src/option.h \ 18 | src/Types.h \ 19 | src/qarchive/qarchive.h \ 20 | src/qarchive/tar/qtar.h \ 21 | src/qarchive/tar/TarItem.h \ 22 | src/qarchive/tar/TarHeader.h \ 23 | src/qarchive/zip/ZipHeader.h \ 24 | src/qarchive/gzip/GzipHeader.h \ 25 | src/qarchive/gzip/GzipItem.h \ 26 | src/qop.h \ 27 | src/commandparser.h \ 28 | src/version.h \ 29 | src/qarchive/qarchive_p.h \ 30 | src/msgdef.h \ 31 | src/qtcompat.h \ 32 | src/utils/util.h \ 33 | src/utils/strutil.h \ 34 | src/utils/convert.h \ 35 | src/utils/qt_util.h 36 | 37 | SOURCES += src/QOutParser.cpp \ 38 | src/gui/ezprogressdialog.cpp \ 39 | src/main.cpp \ 40 | src/qcounterthread.cpp \ 41 | src/qarchive/arcreader.cpp \ 42 | src/option.cpp \ 43 | src/qarchive/qarchive.cpp \ 44 | src/qarchive/tar/qtar.cpp \ 45 | src/qarchive/zip/ZipHeader.cpp \ 46 | src/qarchive/gzip/GzipItem.cpp \ 47 | src/qop.cpp \ 48 | src/commandparser.cpp \ 49 | src/utils/util.cpp \ 50 | src/utils/strutil.cpp \ 51 | src/utils/convert.cpp \ 52 | src/utils/qt_util.cpp 53 | 54 | !*g++* { 55 | HEADERS += src/getopt.h 56 | SOURCES += src/getopt.cpp 57 | } 58 | 59 | 60 | OTHER_FILES += \ 61 | doc/TODO.txt \ 62 | doc/history \ 63 | doc/help-zh_CN.txt \ 64 | doc/help-en_US.txt \ 65 | test/zip-qop.sh \ 66 | test/unzip-qop.sh \ 67 | test/unrar-zip.sh \ 68 | test/tar-qop.sh \ 69 | test/qop-zip.sh \ 70 | test/qop-unzip.sh \ 71 | test/qop-unrar.sh \ 72 | test/qop-tar.sh \ 73 | test/7z-qop.sh \ 74 | test/.findqop.sh \ 75 | configure \ 76 | config.in \ 77 | qtc_packaging/debian_harmattan/rules \ 78 | qtc_packaging/debian_harmattan/README \ 79 | qtc_packaging/debian_harmattan/copyright \ 80 | qtc_packaging/debian_harmattan/control \ 81 | qtc_packaging/debian_harmattan/compat \ 82 | qtc_packaging/debian_harmattan/changelog \ 83 | README 84 | 85 | unix:!symbian { 86 | maemo* { 87 | target.path = /opt/usr/bin 88 | DEFINES += CONFIG_MAEMO 89 | } else { 90 | target.path = /usr/local/bin 91 | } 92 | INSTALLS += target 93 | } 94 | 95 | 96 | unix:maemo* { 97 | isEmpty(PREFIX) { 98 | PREFIX = /opt/usr 99 | } 100 | BINDIR = $$PREFIX/bin 101 | DATADIR =$$PREFIX/share 102 | 103 | DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\" 104 | # install 105 | INSTALLS += target desktop service iconxpm icon26 icon48 icon64 sources 106 | 107 | target.files = bin/$$TARGET i18n 108 | target.path = $$BINDIR 109 | 110 | desktop.path = /usr/share/applications/hildon 111 | desktop.files = data/$${TARGET}.desktop 112 | 113 | service.path = /usr/share/dbus-1/services 114 | service.files = data/$${TARGET}.service 115 | 116 | icon64.path = $$DATADIR/icons/hicolor/64x64/apps 117 | icon64.files = data/64x64/$${TARGET}.png 118 | 119 | sources.files = $$HEADERS $$SOURCES $$FORMS $$RESOURCES $${TARGET}.pro *.ico *.icns *.rc *.plist 120 | sources.path = /opt/usr/src/$${TARGET} 121 | 122 | # 123 | # Targets for debian source and binary package creation 124 | # 125 | debian-src.commands = dpkg-buildpackage -S -r -us -uc -d 126 | debian-bin.commands = dpkg-buildpackage -b -r -uc -d 127 | debian-all.depends = debian-src debian-bin 128 | 129 | # 130 | # Clean all but Makefile 131 | # 132 | compiler_clean.commands = -$(DEL_FILE) $(TARGET) 133 | 134 | QMAKE_EXTRA_TARGETS += debian-all debian-src debian-bin compiler_clean 135 | } 136 | 137 | DISTFILES = $${HEADERS} $${SOURCES} $${TRANSLATIONS} $${OTHER_FILES} 138 | 139 | unix:!symbian:!maemo5 { 140 | target.path = /opt/qop/bin 141 | INSTALLS += target 142 | } 143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /qtc_packaging/debian_fremantle/README: -------------------------------------------------------------------------------- 1 | The Debian Package qop 2 | ---------------------------- 3 | 4 | Comments regarding the Package 5 | 6 | -- Wang Bin Thu, 14 Apr 2011 10:08:20 +0800 7 | 8 | Auther: Wang Bin (aka nukin in ccomve & novesky in motorolafans) 9 | Shanghai university, China 10 | 2010-09-09 11 | wbsecg1@gmail.com 12 | Other links: http://sourceforge.net/projects/qop/files" 13 | http://qt-apps.org/content/show.php/qop?content=132430 14 | 15 | Qt Output Parser for tar, zip, unzip, unrar, 7z with a compression/extraction progress indicator. 16 | Support platforms: windows(Qt4), Linux(Qt4, tested on ubuntu 10.04), motorola ezx(Qt2, tested on ROKR E6) and Maemo5 etc. 17 | 18 | bug: can't kill 7z in windows. 19 | 20 | Usage: qop [-t parserFor] [-n|s] [-chm] [-x archieve|-T totalSteps] [files...] 21 | 22 | -m, --multi-thread: create a new thread to calculate progress bar's total steps. 23 | -h, --help: help 24 | -n, --number: set number of files as total steps. 25 | -s, --size: set size of files as total steps. -s is default 26 | -T, --steps=STEPS: specify total steps. 27 | -t, --parser[=TYPE]: usually is tool's name, such as tar, zip, unzip, unrar. If using xz, lzop etc with tar, parser is tar. -t tar is default. 28 | If you want to extract a .tar or .tar.xxx file and set size as total steps, use -tuntar is better. 29 | -x, --exteact=ARCHIVE: extracting mode. Omit -T argument. Analyze parser and total steps automaticly. 30 | -o, --outdir=dir: set the output dir when using internal extract method(qop -d -x test.tar -o outdir) 31 | -c, --auto-close: auto close when finished 32 | -C, --cmd=command: execute command 33 | -d, --diy[=TARFILE]: using built-in method to extract an archive 34 | 35 | examples: 36 | qop -C zip -ryv -9 test.zip test 37 | qop -C zip -ry -9 test.zip test 38 | qop -C unzip -o test.zip -d exdir 39 | qop -C unrar x -o+ -p- -y rar.rar destdir 40 | qop -C tar cvvf test.tar test 41 | qop -C tar zcvf test.tgz test 42 | qop -C tar zxvvf test.tgz -C /tmp ##only 1 v will not show the right totalsteps and progress 43 | qop tar cvvf test.tar test 44 | tar zcvvf test.tgz test |qop test -m 45 | tar zxvvf test.tgz |qop -T `gzip -l test.tgz |sed -n '$s/\(.*\) \(.*\) .*/\2/p'` -tuntar -c 46 | tar zxvf test.tgz |qop -T `tar -zt = 0.2.2, you can omit -n and -s 57 | tar zcvvf test.tgz test |qop test [-m] 58 | tar zcvf test.tgz test |qop test ##no -m 59 | 60 | extracting a tar.gz file for new version(>=0.1.0): 61 | tar zxvvf test.tar.gz |qop -x test.tar.gz 62 | 63 | 64 | How To Compile: 65 | 1.Desktop and Maemo: Just use QtCreator. 66 | 2.EZX: Use tmake. Or use my configure script. Type 67 | ./configure 68 | make 69 | make pkg 70 | More information about configue script can be got by ./configure --help 71 | -------------------------------------------------------------------------------- /qtc_packaging/debian_fremantle/changelog: -------------------------------------------------------------------------------- 1 | qop (0.3.5) stable; urgency=low 2 | * 3 | 4 | -- Wang Bin 周五, 23 九月 2011 19:53:06 +0800 5 | 6 | qop (0.3.5) stable; urgency=low 7 | 8 | * Add uncomplete zip, unzip, unrar support for -C option. See help-en_US.txt. 9 | 10 | -- Wang Bin Thu, 19 Apr 2011 21:41:55 +0800 11 | 12 | * Initial Release. 13 | 14 | -- Wang Bin Thu, 14 Apr 2011 10:08:20 +0800 15 | -------------------------------------------------------------------------------- /qtc_packaging/debian_fremantle/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /qtc_packaging/debian_fremantle/control: -------------------------------------------------------------------------------- 1 | Source: qop 2 | Section: user/hidden 3 | Priority: optional 4 | Maintainer: Wang Bin 5 | Build-Depends: debhelper (>= 5) 6 | Standards-Version: 3.7.3 7 | Homepage: 8 | 9 | Package: qop 10 | Architecture: any 11 | Depends: 12 | Description: A compression/extraction progress indicator 13 | A compression/extraction progress indicator for tar, zip, unzip, unrar, 7z by parsing their output message. It has a simple 14 | built-in method to unpack tar files. 15 | Support platforms: windows(Qt4), Linux(Qt4, tested on ubuntu 10.10), motorola ezx(Qt2, tested on ROKR E6) and Maemo5 etc. 16 | Latest release: https://sourceforge.net/projects/qop/files/ 17 | http://qt-apps.org/content/show.php/qop?content=132430 18 | XB-Maemo-Icon-26: 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 19 | XB-Maemo-Display-Name: qop 20 | -------------------------------------------------------------------------------- /qtc_packaging/debian_fremantle/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by Wang Bin on 2 | Thu, 14 Apr 2011 10:08:20 +0800. 3 | 4 | It was downloaded from 5 | 6 | Upstream Author(s): 7 | 8 | 9 | 10 | 11 | Copyright: 12 | 13 | 14 | 15 | 16 | License: 17 | 18 | This package is free software; you can redistribute it and/or modify 19 | it under the terms of the GNU General Public License as published by 20 | the Free Software Foundation; either version 2 of the License, or 21 | (at your option) any later version. 22 | 23 | This package is distributed in the hope that it will be useful, 24 | but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | GNU General Public License for more details. 27 | 28 | You should have received a copy of the GNU General Public License 29 | along with this package; if not, write to the Free Software 30 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 31 | 32 | On Debian systems, the complete text of the GNU General 33 | Public License can be found in `/usr/share/common-licenses/GPL'. 34 | 35 | The Debian packaging is (C) 2011, Wang Bin and 36 | is licensed under the GPL, see above. 37 | 38 | 39 | # Please also look if there are files or directories which have a 40 | # different copyright/license attached and list them here. 41 | -------------------------------------------------------------------------------- /qtc_packaging/debian_fremantle/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # This file was originally written by Joey Hess and Craig Small. 5 | # As a special exception, when this file is copied by dh-make into a 6 | # dh-make output file, you may use that output file without restriction. 7 | # This special exception was added by Craig Small in version 0.37 of dh-make. 8 | 9 | # Uncomment this to turn on verbose mode. 10 | #export DH_VERBOSE=1 11 | 12 | 13 | 14 | 15 | 16 | configure: configure-stamp 17 | configure-stamp: 18 | dh_testdir 19 | # Add here commands to configure the package. 20 | 21 | touch configure-stamp 22 | 23 | 24 | build: build-stamp 25 | 26 | build-stamp: configure-stamp 27 | dh_testdir 28 | 29 | # Add here commands to compile the package. 30 | $(MAKE) 31 | #docbook-to-man debian/qop.sgml > qop.1 32 | 33 | touch $@ 34 | 35 | clean: 36 | dh_testdir 37 | dh_testroot 38 | rm -f build-stamp configure-stamp 39 | 40 | # Add here commands to clean up after the build process. 41 | $(MAKE) clean 42 | 43 | dh_clean 44 | 45 | install: build 46 | dh_testdir 47 | dh_testroot 48 | dh_clean -k 49 | dh_installdirs 50 | 51 | # Add here commands to install the package into debian/qop. 52 | $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/qop install 53 | 54 | 55 | # Build architecture-independent files here. 56 | binary-indep: build install 57 | # We have nothing to do by default. 58 | 59 | # Build architecture-dependent files here. 60 | binary-arch: build install 61 | dh_testdir 62 | dh_testroot 63 | dh_installchangelogs 64 | dh_installdocs 65 | dh_installexamples 66 | # dh_install 67 | # dh_installmenu 68 | # dh_installdebconf 69 | # dh_installlogrotate 70 | # dh_installemacsen 71 | # dh_installpam 72 | # dh_installmime 73 | # dh_python 74 | # dh_installinit 75 | # dh_installcron 76 | # dh_installinfo 77 | dh_installman 78 | dh_link 79 | # dh_strip 80 | dh_compress 81 | dh_fixperms 82 | # dh_perl 83 | # dh_makeshlibs 84 | dh_installdeb 85 | # dh_shlibdeps # Uncomment this line for publishing! 86 | dh_gencontrol 87 | dh_md5sums 88 | dh_builddeb 89 | 90 | binary: binary-indep binary-arch 91 | .PHONY: build clean binary-indep binary-arch binary install configure 92 | -------------------------------------------------------------------------------- /qtc_packaging/debian_harmattan/README: -------------------------------------------------------------------------------- 1 | The Debian Package qop 2 | ---------------------------- 3 | 4 | Comments regarding the Package 5 | 6 | -- unknown <> Fri, 24 Jun 2011 15:24:31 +0800 7 | -------------------------------------------------------------------------------- /qtc_packaging/debian_harmattan/changelog: -------------------------------------------------------------------------------- 1 | qop (0.2.14) unstable; urgency=low 2 | 3 | * Initial Release. 4 | 5 | -- unknown <> Fri, 24 Jun 2011 15:24:31 +0800 6 | -------------------------------------------------------------------------------- /qtc_packaging/debian_harmattan/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /qtc_packaging/debian_harmattan/control: -------------------------------------------------------------------------------- 1 | Source: qop 2 | Section: user/other 3 | Priority: optional 4 | Maintainer: unknown <> 5 | Build-Depends: debhelper (>= 5), libqt4-dev 6 | Standards-Version: 3.7.3 7 | Homepage: 8 | 9 | Package: qop 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends} 12 | Description: A compression/extraction progress indicator 13 | 14 | XSBC-Maemo-Display-Name: qop 15 | XB-Maemo-Icon-26: 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 16 | -------------------------------------------------------------------------------- /qtc_packaging/debian_harmattan/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by unknown <> on 2 | Fri, 24 Jun 2011 15:24:31 +0800. 3 | 4 | It was downloaded from 5 | 6 | Upstream Author(s): 7 | 8 | 9 | 10 | 11 | Copyright: 12 | 13 | 14 | 15 | 16 | License: 17 | 18 | This package is free software; you can redistribute it and/or modify 19 | it under the terms of the GNU General Public License as published by 20 | the Free Software Foundation; either version 2 of the License, or 21 | (at your option) any later version. 22 | 23 | This package is distributed in the hope that it will be useful, 24 | but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | GNU General Public License for more details. 27 | 28 | You should have received a copy of the GNU General Public License 29 | along with this package; if not, write to the Free Software 30 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 31 | 32 | On Debian systems, the complete text of the GNU General 33 | Public License can be found in `/usr/share/common-licenses/GPL'. 34 | 35 | The Debian packaging is (C) 2011, unknown <> and 36 | is licensed under the GPL, see above. 37 | 38 | 39 | # Please also look if there are files or directories which have a 40 | # different copyright/license attached and list them here. 41 | -------------------------------------------------------------------------------- /qtc_packaging/debian_harmattan/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # This file was originally written by Joey Hess and Craig Small. 5 | # As a special exception, when this file is copied by dh-make into a 6 | # dh-make output file, you may use that output file without restriction. 7 | # This special exception was added by Craig Small in version 0.37 of dh-make. 8 | 9 | # Uncomment this to turn on verbose mode. 10 | #export DH_VERBOSE=1 11 | 12 | 13 | 14 | 15 | 16 | configure: configure-stamp 17 | configure-stamp: 18 | dh_testdir 19 | # qmake PREFIX=/usr# Uncomment this line for use without Qt Creator 20 | 21 | touch configure-stamp 22 | 23 | 24 | build: build-stamp 25 | 26 | build-stamp: configure-stamp 27 | dh_testdir 28 | 29 | # Add here commands to compile the package. 30 | # $(MAKE) # Uncomment this line for use without Qt Creator 31 | #docbook-to-man debian/qop.sgml > qop.1 32 | 33 | touch $@ 34 | 35 | clean: 36 | dh_testdir 37 | dh_testroot 38 | rm -f build-stamp configure-stamp 39 | 40 | # Add here commands to clean up after the build process. 41 | $(MAKE) clean 42 | 43 | dh_clean 44 | 45 | install: build 46 | dh_testdir 47 | dh_testroot 48 | dh_clean -k 49 | dh_installdirs 50 | 51 | # Add here commands to install the package into debian/qop. 52 | $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/qop install 53 | 54 | 55 | # Build architecture-independent files here. 56 | binary-indep: build install 57 | # We have nothing to do by default. 58 | 59 | # Build architecture-dependent files here. 60 | binary-arch: build install 61 | dh_testdir 62 | dh_testroot 63 | dh_installchangelogs 64 | dh_installdocs 65 | dh_installexamples 66 | # dh_install 67 | # dh_installmenu 68 | # dh_installdebconf 69 | # dh_installlogrotate 70 | # dh_installemacsen 71 | # dh_installpam 72 | # dh_installmime 73 | # dh_python 74 | # dh_installinit 75 | # dh_installcron 76 | # dh_installinfo 77 | dh_installman 78 | dh_link 79 | dh_strip 80 | dh_compress 81 | dh_fixperms 82 | # dh_perl 83 | # dh_makeshlibs 84 | dh_installdeb 85 | # dh_shlibdeps # Uncomment this line for use without Qt Creator 86 | dh_gencontrol 87 | dh_md5sums 88 | dh_builddeb 89 | 90 | binary: binary-indep binary-arch 91 | .PHONY: build clean binary-indep binary-arch binary install configure 92 | -------------------------------------------------------------------------------- /screenshots/qop-ezx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang-bin/qop/3b92c57b1e8289e7e3b61d8287b4f2ad56687792/screenshots/qop-ezx.png -------------------------------------------------------------------------------- /screenshots/qop-maemo5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang-bin/qop/3b92c57b1e8289e7e3b61d8287b4f2ad56687792/screenshots/qop-maemo5.png -------------------------------------------------------------------------------- /screenshots/qop-ubuntu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang-bin/qop/3b92c57b1e8289e7e3b61d8287b4f2ad56687792/screenshots/qop-ubuntu.png -------------------------------------------------------------------------------- /screenshots/qop-win.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang-bin/qop/3b92c57b1e8289e7e3b61d8287b4f2ad56687792/screenshots/qop-win.png -------------------------------------------------------------------------------- /src/QOutParser.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | QOutParser: Achieve tools' output parser. It's a part of QOP. 3 | Copyright (C) 2010 Wangbin 4 | (aka. nukin in ccmove & novesky in http://forum.motorolafans.com) 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | ******************************************************************************/ 20 | #ifndef QOUTPARSER_H 21 | #define QOUTPARSER_H 22 | 23 | #define OP_TEMPLATE 0 24 | #define LINE_LENGTH_MAX 1024 25 | #define NO_SOCKET 1 26 | 27 | #include "qtcompat.h" 28 | #include 29 | #include 30 | #include "qcounterthread.h" 31 | 32 | typedef enum { 33 | All,Simple, Detail, DetailWithRatio, EndZip,End7z, Error, Unknow 34 | } Format; 35 | 36 | class QOutParser; 37 | extern "C" QOutParser* getParser(const QString& type="tar"); 38 | 39 | class QOutParserPrivate; 40 | class QOutParser :public QObject 41 | { 42 | Q_OBJECT 43 | public: 44 | QOutParser(); 45 | ~QOutParser(); 46 | 47 | void start(); //start to parse output 48 | void parseLine(const QString& line); 49 | void startCounterThread(); //start a QCounterThread thread 50 | 51 | void setInterval(unsigned int interval); 52 | void setUpdateMsgOnChange(bool on); 53 | void setMultiThread(bool multiThread); 54 | void setFiles(const QStringList&); 55 | void setCountType(QCounterThread::CountType); 56 | void setRecount(bool); 57 | 58 | public slots: 59 | void initTimer(); 60 | void setTotalSize(int); 61 | void terminate(); 62 | 63 | private slots: 64 | void slotFinished(); 65 | void slotResetUnit(); 66 | #if !NO_SOCKET 67 | //void readFromSocket(int); 68 | #endif 69 | signals: 70 | void valueChanged(int); 71 | void textChanged(const QString&); 72 | void finished(); 73 | void maximumChanged(int); 74 | void unitChanged(); 75 | 76 | protected: 77 | virtual void timerEvent(QTimerEvent *); 78 | virtual Format parse(const QString& line); //return int 79 | //

File: %1, _out=dspFormat.arg(file); 80 | //virtual void setDiaplayFormat(Format fmt=All,const QString& txt=""); 81 | 82 | Q_DECLARE_PRIVATE(QOutParser) 83 | QOutParserPrivate *d_ptr; 84 | 85 | }; 86 | 87 | 88 | #define Q_DECLARE_OUTPARSER(T) \ 89 | class Q##T##OutParser :public QOutParser \ 90 | { \ 91 | protected: Format parse(const QString& line); \ 92 | }; 93 | 94 | //NO Q_OBJECT? 95 | 96 | Q_DECLARE_OUTPARSER(Tar) 97 | //Q_DECLARE_OUTPARSER(Untar) 98 | Q_DECLARE_OUTPARSER(Zip) 99 | Q_DECLARE_OUTPARSER(Unzip) 100 | Q_DECLARE_OUTPARSER(Unrar) 101 | Q_DECLARE_OUTPARSER(Lzip) 102 | Q_DECLARE_OUTPARSER(Upx) 103 | Q_DECLARE_OUTPARSER(7z) 104 | 105 | class QUntarOutParser :public QOutParser 106 | { 107 | public: 108 | QUntarOutParser(); 109 | 110 | protected: 111 | Format parse(const QString& line); 112 | }; 113 | 114 | #endif // QOUTPARSER_H 115 | -------------------------------------------------------------------------------- /src/Types.h: -------------------------------------------------------------------------------- 1 | /* Types.h -- Basic types 2 | 2010-03-11 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_TYPES_H 5 | #define __7Z_TYPES_H 6 | 7 | #include 8 | 9 | #ifdef _WIN32 10 | #include 11 | #endif 12 | 13 | #ifndef EXTERN_C_BEGIN 14 | #ifdef __cplusplus 15 | #define EXTERN_C_BEGIN extern "C" { 16 | #define EXTERN_C_END } 17 | #else 18 | #define EXTERN_C_BEGIN 19 | #define EXTERN_C_END 20 | #endif 21 | #endif 22 | 23 | EXTERN_C_BEGIN 24 | 25 | #define SZ_OK 0 26 | 27 | #define SZ_ERROR_DATA 1 28 | #define SZ_ERROR_MEM 2 29 | #define SZ_ERROR_CRC 3 30 | #define SZ_ERROR_UNSUPPORTED 4 31 | #define SZ_ERROR_PARAM 5 32 | #define SZ_ERROR_INPUT_EOF 6 33 | #define SZ_ERROR_OUTPUT_EOF 7 34 | #define SZ_ERROR_READ 8 35 | #define SZ_ERROR_WRITE 9 36 | #define SZ_ERROR_PROGRESS 10 37 | #define SZ_ERROR_FAIL 11 38 | #define SZ_ERROR_THREAD 12 39 | 40 | #define SZ_ERROR_ARCHIVE 16 41 | #define SZ_ERROR_NO_ARCHIVE 17 42 | 43 | typedef int SRes; 44 | 45 | #ifdef _WIN32 46 | typedef DWORD WRes; 47 | #else 48 | typedef int WRes; 49 | #endif 50 | 51 | #ifndef RINOK 52 | #define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; } 53 | #endif 54 | 55 | typedef unsigned char Byte; 56 | typedef short Int16; 57 | typedef unsigned short UInt16; 58 | 59 | #ifdef _LZMA_UINT32_IS_ULONG 60 | typedef long Int32; 61 | typedef unsigned long UInt32; 62 | #else 63 | typedef int Int32; 64 | typedef unsigned int UInt32; 65 | #endif 66 | 67 | #ifdef _SZ_NO_INT_64 68 | 69 | /* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers. 70 | NOTES: Some code will work incorrectly in that case! */ 71 | 72 | typedef long Int64; 73 | typedef unsigned long UInt64; 74 | 75 | #else 76 | 77 | #if defined(_MSC_VER) || defined(__BORLANDC__) 78 | typedef __int64 Int64; 79 | typedef unsigned __int64 UInt64; 80 | #else 81 | typedef long long int Int64; 82 | typedef unsigned long long int UInt64; 83 | #endif 84 | 85 | #endif 86 | 87 | #ifdef _LZMA_NO_SYSTEM_SIZE_T 88 | typedef UInt32 SizeT; 89 | #else 90 | typedef size_t SizeT; 91 | #endif 92 | 93 | typedef int Bool; 94 | #define True 1 95 | #define False 0 96 | 97 | 98 | #ifdef _WIN32 99 | #define MY_STD_CALL __stdcall 100 | #else 101 | #define MY_STD_CALL 102 | #endif 103 | 104 | #ifdef _MSC_VER 105 | 106 | #if _MSC_VER >= 1300 107 | #define MY_NO_INLINE __declspec(noinline) 108 | #else 109 | #define MY_NO_INLINE 110 | #endif 111 | 112 | #define MY_CDECL __cdecl 113 | #define MY_FAST_CALL __fastcall 114 | 115 | #else 116 | 117 | #define MY_CDECL 118 | #define MY_FAST_CALL 119 | 120 | #endif 121 | 122 | 123 | /* The following interfaces use first parameter as pointer to structure */ 124 | 125 | typedef struct 126 | { 127 | Byte (*Read)(void *p); /* reads one byte, returns 0 in case of EOF or error */ 128 | } IByteIn; 129 | 130 | typedef struct 131 | { 132 | void (*Write)(void *p, Byte b); 133 | } IByteOut; 134 | 135 | typedef struct 136 | { 137 | SRes (*Read)(void *p, void *buf, size_t *size); 138 | /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. 139 | (output(*size) < input(*size)) is allowed */ 140 | } ISeqInStream; 141 | 142 | /* it can return SZ_ERROR_INPUT_EOF */ 143 | SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size); 144 | SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType); 145 | SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf); 146 | 147 | typedef struct 148 | { 149 | size_t (*Write)(void *p, const void *buf, size_t size); 150 | /* Returns: result - the number of actually written bytes. 151 | (result < size) means error */ 152 | } ISeqOutStream; 153 | 154 | typedef enum 155 | { 156 | SZ_SEEK_SET = 0, 157 | SZ_SEEK_CUR = 1, 158 | SZ_SEEK_END = 2 159 | } ESzSeek; 160 | 161 | typedef struct 162 | { 163 | SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */ 164 | SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); 165 | } ISeekInStream; 166 | 167 | typedef struct 168 | { 169 | SRes (*Look)(void *p, const void **buf, size_t *size); 170 | /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. 171 | (output(*size) > input(*size)) is not allowed 172 | (output(*size) < input(*size)) is allowed */ 173 | SRes (*Skip)(void *p, size_t offset); 174 | /* offset must be <= output(*size) of Look */ 175 | 176 | SRes (*Read)(void *p, void *buf, size_t *size); 177 | /* reads directly (without buffer). It's same as ISeqInStream::Read */ 178 | SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin); 179 | } ILookInStream; 180 | 181 | SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size); 182 | SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset); 183 | 184 | /* reads via ILookInStream::Read */ 185 | SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType); 186 | SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size); 187 | 188 | #define LookToRead_BUF_SIZE (1 << 14) 189 | 190 | typedef struct 191 | { 192 | ILookInStream s; 193 | ISeekInStream *realStream; 194 | size_t pos; 195 | size_t size; 196 | Byte buf[LookToRead_BUF_SIZE]; 197 | } CLookToRead; 198 | 199 | void LookToRead_CreateVTable(CLookToRead *p, int lookahead); 200 | void LookToRead_Init(CLookToRead *p); 201 | 202 | typedef struct 203 | { 204 | ISeqInStream s; 205 | ILookInStream *realStream; 206 | } CSecToLook; 207 | 208 | void SecToLook_CreateVTable(CSecToLook *p); 209 | 210 | typedef struct 211 | { 212 | ISeqInStream s; 213 | ILookInStream *realStream; 214 | } CSecToRead; 215 | 216 | void SecToRead_CreateVTable(CSecToRead *p); 217 | 218 | typedef struct 219 | { 220 | SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize); 221 | /* Returns: result. (result != SZ_OK) means break. 222 | Value (UInt64)(Int64)-1 for size means unknown value. */ 223 | } ICompressProgress; 224 | 225 | typedef struct 226 | { 227 | void *(*Alloc)(void *p, size_t size); 228 | void (*Free)(void *p, void *address); /* address can be 0 */ 229 | } ISzAlloc; 230 | 231 | #define IAlloc_Alloc(p, size) (p)->Alloc((p), size) 232 | #define IAlloc_Free(p, a) (p)->Free((p), a) 233 | 234 | EXTERN_C_END 235 | 236 | #endif 237 | -------------------------------------------------------------------------------- /src/algorithm/zlib_alg.cpp: -------------------------------------------------------------------------------- 1 | #include "zlib_alg.h" 2 | 3 | int inflate_zlib(Bytef *dest, unsigned long *destLen, const Bytef *source, unsigned long sourceLen) 4 | { 5 | z_stream stream; 6 | int err; 7 | 8 | stream.next_in = (Bytef*)source; 9 | stream.avail_in = (uInt)sourceLen; 10 | if ((uLong)stream.avail_in != sourceLen) 11 | return Z_BUF_ERROR; 12 | 13 | stream.next_out = dest; 14 | stream.avail_out = (uInt)*destLen; 15 | if ((uLong)stream.avail_out != *destLen) 16 | return Z_BUF_ERROR; 17 | 18 | stream.zalloc = (alloc_func)0; 19 | stream.zfree = (free_func)0; 20 | 21 | err = inflateInit2(&stream, -MAX_WBITS); 22 | if (err != Z_OK) 23 | return err; 24 | 25 | err = inflate(&stream, Z_FINISH); 26 | if (err != Z_STREAM_END) { 27 | inflateEnd(&stream); 28 | if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) 29 | return Z_DATA_ERROR; 30 | return err; 31 | } 32 | *destLen = stream.total_out; 33 | 34 | err = inflateEnd(&stream); 35 | return err; 36 | } 37 | 38 | int deflate_zlib(Bytef *dest, unsigned long *destLen, const Bytef *source, unsigned long sourceLen) 39 | { 40 | z_stream stream; 41 | int err; 42 | 43 | stream.next_in = (Bytef*)source; 44 | stream.avail_in = (uInt)sourceLen; 45 | stream.next_out = dest; 46 | stream.avail_out = (uInt)*destLen; 47 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 48 | 49 | stream.zalloc = (alloc_func)0; 50 | stream.zfree = (free_func)0; 51 | stream.opaque = (voidpf)0; 52 | 53 | err = deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY); 54 | if (err != Z_OK) return err; 55 | 56 | err = deflate(&stream, Z_FINISH); 57 | if (err != Z_STREAM_END) { 58 | deflateEnd(&stream); 59 | return err == Z_OK ? Z_BUF_ERROR : err; 60 | } 61 | *destLen = stream.total_out; 62 | 63 | err = deflateEnd(&stream); 64 | return err; 65 | } 66 | -------------------------------------------------------------------------------- /src/algorithm/zlib_alg.h: -------------------------------------------------------------------------------- 1 | #ifndef ZLIB_ALG_H 2 | #define ZLIB_ALG_H 3 | 4 | #include "zlib.h" 5 | 6 | extern "C" { 7 | int deflate_zlib(Bytef *dest, unsigned long *destLen, const Bytef *source, unsigned long sourceLen); 8 | int deflate_zlib(Bytef *dest, unsigned long *destLen, const Bytef *source, unsigned long sourceLen); 9 | } 10 | 11 | #endif // ZLIB_ALG_H 12 | -------------------------------------------------------------------------------- /src/commandparser.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | QOP: Qt Output Parser for tar, zip etc with a compression/extraction progress indicator 3 | Copyright (C) 2011 Wangbin 4 | (aka. nukin in ccmove & novesky in http://forum.motorolafans.com) 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | ******************************************************************************/ 20 | 21 | #ifndef COMMANDPARSER_H 22 | #define COMMANDPARSER_H 23 | 24 | /*! 25 | You can directly write CommandParser(cmd).files(), CommandParser(cmd).archive(), 26 | CommandParser(cmd).filesSize(), CommandParser(cmd).archiveUnpackSize() etc. to get the 27 | correct value you need; 28 | The key technology is that class CommandParser has a CommandParser pointer which points to 29 | a command determined CommandParser pointer; Some CommandParser's member functions call the 30 | pointer's corresponding functions. 31 | 32 | You also can write code like this: 33 | CommandParser cp; 34 | cp.setCommand(cmd); 35 | uint s=cp.archiveUnpackSize(); 36 | */ 37 | 38 | #define COUNTER_THREAD 0 39 | #include 40 | #include "qtcompat.h" 41 | 42 | class QCounterThread; 43 | class CommandParserPrivate; 44 | class CommandParser 45 | { 46 | Q_DECLARE_PRIVATE(CommandParser) 47 | public: 48 | typedef enum { 49 | Size=0x0, Num=0x1, NumNoDir=0x3 50 | } CountType; 51 | 52 | CommandParser(const QString& cmd = QString()); 53 | //CommandParser(const QString& program, const QStringList& argv); 54 | 55 | virtual ~CommandParser(); 56 | 57 | virtual void setCommand(const QString& cmd); 58 | 59 | //compressFiles, unpackFiles, exculde files 60 | virtual QStringList files(); 61 | virtual QString archive(); 62 | virtual CountType countType(); 63 | virtual bool isCompressMode(); 64 | 65 | /*! 66 | CommandParser(cmd).unpackSize(); 67 | */ 68 | QString program() const; 69 | //bool isSize() const; 70 | size_t filesCount() const; 71 | size_t filesSize() const; 72 | size_t archiveSize() const; 73 | size_t archiveUnpackSize() const; 74 | 75 | QCounterThread* counterThread() const; 76 | 77 | protected: 78 | CommandParserPrivate *d_ptr; 79 | }; 80 | 81 | #endif // COMMANDPARSER_H 82 | -------------------------------------------------------------------------------- /src/getopt.h: -------------------------------------------------------------------------------- 1 | /* Declarations for getopt. 2 | Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. 3 | This file is part of the GNU C Library. 4 | 5 | The GNU C Library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public License as 7 | published by the Free Software Foundation; either version 2 of the 8 | License, or (at your option) any later version. 9 | 10 | The GNU C Library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with the GNU C Library; see the file COPYING.LIB. If not, 17 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 | Boston, MA 02111-1307, USA. */ 19 | 20 | #ifndef GETOPT_H 21 | #define GETOPT_H 22 | 23 | #ifndef __STDC__ 24 | # define __STDC__ 1 25 | #endif 26 | 27 | /**\file 28 | * Declarations for getopt 29 | */ 30 | 31 | #if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) 32 | // MacOS/X already has a valid getopt; avoid link errors. 33 | #define getopt __getopt 34 | #define optarg __optarg 35 | #define opterr __opterr 36 | #define optind __optind 37 | #define optopt __optopt 38 | #endif 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif //__cplusplus 43 | 44 | /** 45 | For communication from `getopt' to the caller. 46 | When `getopt' finds an option that takes an argument, 47 | the argument value is returned here. 48 | Also, when `ordering' is RETURN_IN_ORDER, 49 | each non-option ARGV-element is returned here. */ 50 | extern char *optarg; 51 | 52 | /** 53 | Index in ARGV of the next element to be scanned. 54 | This is used for communication to and from the caller 55 | and for communication between successive calls to `getopt'. 56 | 57 | On entry to `getopt', zero means this is the first call; initialize. 58 | 59 | When `getopt' returns -1, this is the index of the first of the 60 | non-option elements that the caller should itself scan. 61 | 62 | Otherwise, `optind' communicates from one call to the next 63 | how much of ARGV has been scanned so far. */ 64 | extern int optind; 65 | 66 | /** 67 | Callers store zero here to inhibit the error message `getopt' prints 68 | for unrecognized options. */ 69 | extern int opterr; 70 | 71 | /** 72 | Set to an option character which was unrecognized. */ 73 | extern int optopt; 74 | 75 | /** 76 | Describe the long-named options requested by the application. 77 | The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector 78 | of `struct option' terminated by an element containing a name which is 79 | zero. 80 | 81 | The field `has_arg' is: 82 |
 83 |    no_argument		(or 0) if the option does not take an argument,
 84 |    required_argument	(or 1) if the option requires an argument,
 85 |    optional_argument 	(or 2) if the option takes an optional argument.
 86 |    
87 | 88 | If the field `flag' is not 0, it points to a variable that is set 89 | to the value given in the field `val' when the option is found, but 90 | left unchanged if the option is not found. 91 | 92 | To have a long-named option do something other than set an `int' to 93 | a compiled-in constant, such as set a value from `optarg', set the 94 | option's `flag' field to zero and its `val' field to a nonzero 95 | value (the equivalent single-letter option character, if there is 96 | one). For long options that have a zero `flag' field, `getopt' 97 | returns the contents of the `val' field. */ 98 | struct option 99 | { 100 | #if defined (__STDC__) && __STDC__ 101 | const char *name; 102 | #else 103 | char *name; 104 | #endif 105 | /* has_arg can't be an enum because some compilers complain about 106 | type mismatches in all the code that assumes it is an int. */ 107 | int has_arg; 108 | int *flag; 109 | int val; 110 | }; 111 | 112 | /* Names for the values of the `has_arg' field of `struct option'. */ 113 | 114 | #define no_argument 0 115 | #define required_argument 1 116 | #define optional_argument 2 117 | 118 | extern int getopt (int argc, char *const *argv, 119 | const char *shortopts); 120 | extern int getopt_long (int argc, char *const *argv, 121 | const char *shortopts, const struct option *longopts, 122 | int *longind); 123 | extern int getopt_long_only (int argc, 124 | char *const *argv, const char *shortopts, 125 | const struct option *longopts, int *longind); 126 | 127 | #ifdef __cplusplus 128 | } 129 | #endif //__cplusplus 130 | #endif 131 | -------------------------------------------------------------------------------- /src/gui/ezprogressdialog.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | EZProgressDialog 3 | Copyright (C) 2010 Wangbin 4 | (aka. nukin in ccmove & novesky in http://forum.motorolafans.com) 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | ******************************************************************************/ 20 | #ifndef EZPROGRESSDIALOG_H 21 | #define EZPROGRESSDIALOG_H 22 | /*! 23 | 2010-08-24 24 | TODO: 25 | GridLayout 26 | Mutil-progressBar 27 | Content type: QTextEdit 28 | */ 29 | #include 30 | #include "qtcompat.h" 31 | 32 | #if !CONFIG_EZX 33 | #define ZApplication QApplication 34 | #include 35 | #include //include it so that we can use it's apis directly. 36 | #else 37 | #include 38 | #include 39 | #include 40 | #endif //CONFIG_EZX 41 | #include 42 | 43 | 44 | //class QLabel; 45 | class UTIL_ProgressBar; 46 | class ZPushButton; //need by addButton(ZPushButton*,...) in Qt4, include is not enough. why? 47 | class EZProgressDialogPrivate; 48 | 49 | class EZProgressDialog : public ZBaseDialog { 50 | Q_OBJECT 51 | Q_DECLARE_PRIVATE(EZProgressDialog) 52 | //Q_PROPERTY(bool wasCanceled READ wasCanceled) 53 | Q_PROPERTY(int maximum READ maximum WRITE setMaximum) 54 | Q_PROPERTY(int value READ value WRITE setValue) 55 | Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset) 56 | Q_PROPERTY(bool autoClose READ autoClose WRITE setAutoClose) 57 | //Q_PROPERTY(int minimumDuration READ minimumDuration WRITE setMinimumDuration) 58 | //Q_PROPERTY(QString labelText READ labelText WRITE setLabelText) 59 | public: 60 | explicit EZProgressDialog(QWidget *parent = 0,Qt::WFlags f=0); 61 | EZProgressDialog(const QString& labelText,const QString& cancelButtonText="Cancel",int value=0,int max=100,QWidget* parent=0,Qt::WFlags f=0); 62 | ~EZProgressDialog(); 63 | 64 | void addButton(ZPushButton *button,int index=-1,int stretch=0,Alignment align=0); //index<0, insert at the tail 65 | void addButton(const QString& text=0,int index=-1,int stretch=0,Alignment align=0); //addButton(,Align) 66 | void setButtonText(int index,const QString& text); 67 | //#include first. connecting signals to slots etc. index<0, return the last index of abs(index) 68 | //Don't only write ZPushButton* button(...); Thus the ZPushButton can't convert to QPushButton in connections 69 | //just addButton() and connect(button(0)...) one by one. connection is not dynamic. why? 70 | ZPushButton *button(int index=0) const; 71 | int buttonsCount() const; 72 | 73 | void addLabel(QLabel* label,int index=-1,int stretch=0,Alignment align=0); 74 | void addLabel(const QString& text=0,int index=-1,int stretch=0,Alignment align=0); 75 | void setLabelText(int index,const QString& text); 76 | QLabel *label(int index=0) const; 77 | int labelsCount() const; 78 | void setLabelFont(int index,const QFont& font); 79 | 80 | void setAutoClose(bool); 81 | void setAutoReset(bool); 82 | bool autoClose() const; 83 | bool autoReset() const; 84 | void setBar(UTIL_ProgressBar*); 85 | void setLabel(QLabel*); //set the content label 86 | int value() const; 87 | int maximum() const; 88 | 89 | //bool clickDo(int index,const QObject* receiver,const char* member=0); 90 | //bool clickUndo(int index,const QObject* receiver,const char* member=0); 91 | 92 | UTIL_ProgressBar* bar(); 93 | 94 | signals: 95 | void canceled(); //emit when closing 96 | void cancelled(); 97 | void buttonClicked(int); 98 | 99 | public slots: 100 | void reset(); 101 | void setMaximum(int maximum); 102 | void retranslateUi(); 103 | void setLabelText(const QString&); 104 | void setValue(int); 105 | void setProgress(int p) {setValue(p);} 106 | 107 | void removeButton(int index=-1); 108 | void removeLabel(int index=-1); 109 | 110 | protected: 111 | virtual void closeEvent(QCloseEvent *); 112 | virtual void timerEvent(QTimerEvent*); 113 | //virtual void hideEvent(QHideEvent *); 114 | 115 | private slots: 116 | void slotButtonClicked(); 117 | 118 | private: 119 | void resizeButtons(); 120 | 121 | #if !INHERIT_PRIVATE || (QT_VERSION < 0x040000) 122 | EZProgressDialogPrivate *d_ptr; 123 | #endif 124 | }; 125 | 126 | #endif // EZPROGRESSDIALOG_H 127 | -------------------------------------------------------------------------------- /src/gui/ezprogressdialog_p.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | EZProgressDialog 3 | Copyright (C) 2010 Wangbin 4 | (aka. nukin in ccmove & novesky in http://forum.motorolafans.com) 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | ******************************************************************************/ 20 | #ifndef EZPROGRESSDIALOG_P_H 21 | #define EZPROGRESSDIALOG_P_H 22 | #include "qtcompat.h" 23 | #define INHERIT_PRIVATE 0 24 | 25 | #include 26 | #if CONFIG_QT4 27 | #include 28 | #include 29 | # if INHERIT_PRIVATE 30 | #include 31 | # endif 32 | #else 33 | #define INHERIT_PRIVATE 0 34 | class QLabel; 35 | #endif 36 | #if CONFIG_EZX 37 | #include 38 | #include 39 | #else 40 | #include 41 | #endif 42 | #include 43 | 44 | class EZProgressDialog; 45 | class QString; 46 | //class QHBoxLayout; 47 | //class QVBoxLayout; 48 | //class UTIL_ProgressBar; 49 | 50 | #if CONFIG_QT4 51 | typedef QListIterator ButtonIterator; 52 | typedef QListIterator LabelIterator; 53 | #else 54 | typedef QListIterator ButtonIterator; 55 | typedef QListIterator LabelIterator; 56 | #endif 57 | 58 | class EZProgressDialogPrivate 59 | #if (QT_VERSION >= 0x040000) && !defined(QT_NO_QOBJECT) && INHERIT_PRIVATE 60 | :public QDialogPrivate 61 | #endif 62 | { 63 | Q_DECLARE_PUBLIC(EZProgressDialog) 64 | public: 65 | EZProgressDialogPrivate():labelLayout(0),content(0),bar(0) 66 | ,buttonLayout(0),autoReset(true),autoClose(false) 67 | { 68 | #if CONFIG_EZX 69 | value=0; 70 | #endif 71 | } 72 | 73 | ~EZProgressDialogPrivate() { 74 | //ButtonIterator it(buttons); 75 | #if CONFIG_QT4 76 | //for(it.toFront();it.hasNext();) { 77 | //delete it.next(); // 78 | qDeleteAll(buttons.begin(),buttons.end()); 79 | //for(it_l.toFront();it_l.hasNext();) { 80 | // delete it_l.next(); // 81 | qDeleteAll(labels.begin(),labels.end()); 82 | #else 83 | ButtonIterator it(buttons); 84 | for(it.toFirst();it.current();++it) //{ 85 | delete *it; // 86 | LabelIterator it_l(labels); 87 | for(it_l.toFirst();it_l.current();++it_l) //{ 88 | delete *it_l; // 89 | #endif 90 | buttons.clear(); 91 | labels.clear(); 92 | delete labelLayout; 93 | delete buttonLayout; 94 | delete bar; 95 | //delete q_ptr; //Memory error! 96 | } 97 | 98 | 99 | void setupUi(EZProgressDialog* dialog); 100 | void init(const QString &labelText, int value, int max); 101 | 102 | QVBoxLayout *labelLayout; 103 | QLabel *content; 104 | UTIL_ProgressBar *bar; 105 | QHBoxLayout *buttonLayout; 106 | #if QT_VERSION >= 0x040000 107 | QList labels; 108 | QList buttons; 109 | #else 110 | QList labels; 111 | QList buttons; 112 | #endif //CONFIG_QT4 113 | QTime time; 114 | 115 | #if !INHERIT_PRIVATE || (QT_VERSION < 0x040000) 116 | EZProgressDialog *q_ptr; 117 | #endif 118 | bool autoReset, autoClose; 119 | #if CONFIG_EZX 120 | int value; 121 | #endif 122 | }; 123 | 124 | #endif // EZPROGRESSDIALOG_P_H 125 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | QOP: Qt Output Parser for tar, zip etc with a compression/extraction progress indicator 3 | Copyright (C) 2010 Wangbin 4 | (aka. nukin in ccmove & novesky in http://forum.motorolafans.com) 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | ******************************************************************************/ 20 | 21 | #include "qtcompat.h" 22 | 23 | #if CONFIG_EZX 24 | #include 25 | #include 26 | #else 27 | #include 28 | #endif //CONFIG_EZX 29 | 30 | #include 31 | //#include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include "qop.h" 38 | #include "option.h" 39 | #include "version.h" 40 | #include "utils/util.h" 41 | 42 | static const char *appName=(char*)malloc(64); 43 | 44 | void printHelp() 45 | { 46 | fprintf(stderr, APP_NAME " %s\n" 47 | "Usage: %s [-interval=Nunit] [--all] [-t parserFor] [-n|s] [-ahmc] [-x archieve|-T totalSteps] [files...] [-C cmd]\n" 48 | " -a, --all update all changes. default is update on timer event\n" 49 | " -F, --time-format=f setup time format. utc(iso8601) or normal" 50 | " -i, --interval=Nunit update the progress every N seconds/mseconds. unit can be s, sec[s],seconds(N can be float) or msec[s](N is int)\n" 51 | " -t, --parser[=TYPE] parser(tar,untar,zip,unzip,unrar,lzip.upx)\n" 52 | " -n, --number count number of files as total steps\n" 53 | " -s, --size count size of files as total steps\n" 54 | " -T, --steps=STEPS specify total steps.\n" 55 | " -h, --help help. print me\n" 56 | " -m, --multi-thread multi-thread counting steps while (de)compressing\n" 57 | " -c, --auto-close auto close when finished\n" 58 | " -C, --cmd=command execute command. e.g. -C tar cvvf test.tar test\n" 59 | " -x, --extract=FILE indicates extracting progress\n" 60 | " -o, --outdir=dir set the output dir when using internal extract method\n" 61 | 62 | "\nCopyright (C) 2010 Wangbin(nukin CCMOVE, aka novesky in motorolafans)\n" 63 | "This program comes with ABSOLUTELY NO WARRANTY, to the extent permitted by low.\n" 64 | "This is free software, and you are welcome to redistribute it " 65 | "under the terms of the GNU General Public Licence version 2\n.\n" 66 | "\n" 67 | "Project:\n" 68 | " https://github.com/wang-bin/qop\n" 69 | " http://sourceforge.net/projects/qop/files\n" 70 | " http://qt-apps.org/content/show.php/qop?content=132430\n" 71 | "Send bugreports to \n\n" 72 | , APP_VERSION_STR, appName); 73 | fflush(NULL); 74 | } 75 | 76 | int main(int argc, char *argv[]) 77 | { 78 | appName=getFileName(argv[0]); 79 | qDebug("%s %s\nQt %s\n", APP_NAME, APP_VERSION_STR, qVersion()); 80 | 81 | opts_t options=opts_parse(argc,argv); 82 | 83 | ZApplication a(argc, argv, QApplication::GuiClient); 84 | #if CONFIG_QT4 85 | QApplication::setApplicationName(APP_NAME); 86 | #if QT_VERSION >= QT_VERSION_CHECK(4, 4, 0) 87 | QApplication::setApplicationVersion(APP_VERSION_STR); 88 | #endif 89 | QApplication::setOrganizationName("Wang Bin"); 90 | 91 | #endif 92 | 93 | #if CONFIG_QT4 94 | QString dirname=QCoreApplication::applicationDirPath(); 95 | #else 96 | QString dirname=QFileInfo(argv[0]).dirPath(); 97 | //QString dirname=getFileDir(argv[0]);// 98 | #endif 99 | //QDir::setCurrent(dirname); //bad in windows cygwin 100 | ZDEBUG("dir: %s",qPrintable(dirname)); 101 | 102 | QTranslator appTranslator(0); 103 | #if CONFIG_EZX 104 | QString sysLang=ZLanguage::getSystemLanguageCode(); 105 | appTranslator.load(APP_NAME "_" + sysLang, dirname + "/i18n"); 106 | //QString(dirname)+"/i18n" will load fail, 乱码 107 | #else 108 | QString sysLang=QLocale::system().name(); 109 | appTranslator.load(APP_NAME "-" + sysLang, dirname + "/i18n"); 110 | #endif //CONFIG_EZX 111 | ZDEBUG("system language: %s",qPrintable(sysLang)); 112 | a.installTranslator(&appTranslator); 113 | //Need QtTranslator 114 | 115 | //QTextCodec::setCodecForTr(QTextCodec::codecForName("GBK")); 116 | 117 | Qop qop; 118 | #if !CONFIG_QT4 119 | a.setMainWidget(qop.progress); 120 | #endif //CONFIG_QT4 121 | ZDEBUG("Steps from options: %d",options->steps); 122 | qop.setTimeFormat(options->time_format); 123 | qop.setInterval(options->interval); 124 | qop.setUpdateAllMessage(options->all_msg); 125 | if(!options->hide) 126 | qop.progress->show(); 127 | //order is important 128 | //qop.parser_type=options->parser_type; 129 | qop.setArchive(options->x_file); 130 | 131 | //internal method 132 | if(options->diy || argc<2) { 133 | qop.extract(options->x_file,options->out_dir); 134 | //qDebug("%s", options->x_file); 135 | } 136 | else if(!options->cmd==0) 137 | qop.execute(QString::fromLocal8Bit(options->cmd)); 138 | else { 139 | qop.parser_type=options->parser_type; 140 | ZDEBUG("steps %d",options->steps); 141 | qop.initParser(); 142 | if(options->unit==0) qop.parser->setCountType(QCounterThread::Size); 143 | else if(options->unit==1) qop.parser->setCountType(QCounterThread::Num); 144 | if(options->steps>0) { 145 | qop.parser->setRecount(false); 146 | qop.parser->setTotalSize(options->steps); 147 | //qop.progress->setMaximum(options->steps); 148 | } 149 | if(qop.steps<=0) { //compress 150 | if(options->steps>0) qop.parser->setTotalSize(options->steps); 151 | QStringList files=QStringList(); 152 | //why is optind? 153 | for(int i=options->optind;isetFiles(files); 155 | qop.parser->setMultiThread(options->multi_thread); 156 | qop.parser->startCounterThread(); 157 | } 158 | #if NO_SOCKET 159 | qop.parser->start(); 160 | #endif 161 | } 162 | #if CONFIG_EZX 163 | a.processEvents(); 164 | #endif 165 | //progress->exec(); 166 | if(options->auto_close) exit(0); 167 | 168 | return a.exec(); 169 | } 170 | 171 | -------------------------------------------------------------------------------- /src/msgdef.h: -------------------------------------------------------------------------------- 1 | #ifndef SMGDEF_H 2 | #define SMGDEF_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | //replace '/' in filename with "/\n", or append().append()...file.replace(file.lastIndexOf('/'), if end with '/'? 9 | static QString g_size_tr; 10 | static QString g_processed_tr; 11 | static QString g_speed_tr; 12 | static QString g_ratio_tr; 13 | static QString g_elapsed_remain_tr; 14 | static QString g_files_tr; 15 | static int g_align_length; 16 | 17 | static void initTranslations() { 18 | g_size_tr = QObject::tr("Size: "); 19 | g_processed_tr = QObject::tr("Processed: "); 20 | g_speed_tr = QObject::tr("Speed: "); 21 | g_ratio_tr = QObject::tr("Ratio: "); 22 | g_elapsed_remain_tr = QObject::tr("Elapsed: %1s Remaining: %2s"); 23 | g_files_tr = QObject::tr("files"); 24 | g_align_length = -(std::max(g_size_tr.length(), g_processed_tr.length())); 25 | } 26 | 27 | 28 | 29 | #if QT_VERSION >= 0x040600 30 | //QStringBuilder 31 | #define QT_USE_FAST_CONCATENATION 32 | #define QT_USE_FAST_OPERATOR_PLUS 33 | 34 | #define g_BaseMsg_Detail(file, size, processed, max_str) \ 35 | file + QLatin1String("\n") + g_size_tr + QString(size2str(size)) + QLatin1String("\n") + g_processed_tr + QString(size2str(processed)) + max_str + QLatin1String("\n") 36 | // QString("%1\n%2%3\n%4%5%6\n").arg(file).arg(g_size_tr, g_align_length).arg(size2str(size)).arg(g_processed_tr, g_align_length).arg(size2str(processed)).arg(max) 37 | 38 | #define g_ExtraMsg_Detail(speed, elapsed, left) \ 39 | g_speed_tr + QString(size2str(speed)) + QLatin1String("/s\n") + g_elapsed_remain_tr.arg(g_time_convert(elapsed)).arg(g_time_convert(left*1000)) 40 | //g_speed_tr + QLatin1String(size2str(speed)) + QLatin1String("/s\n") + g_elapsed_remain_tr.arg(elapsed/1000.,0,'f',1).arg(left,0,'f',1) 41 | //QString("%1%2/s\n%3").arg(g_speed_tr).arg(size2str(speed)).arg(g_elapsed_remain_tr.arg(elapsed/1000.,0,'f',1).arg(left,0,'f',1)) 42 | 43 | //slower? 44 | #define g_BaseMsg_Simple(file, value, max_str) \ 45 | file + QLatin1String("\n") + g_processed_tr + QString::number(value) + max_str + g_files_tr + QLatin1String("\n") 46 | //QString("%1\n%2%3%4\n").arg(file).arg(g_processed_tr).arg(value).arg(max_str).arg(g_files_tr) 47 | 48 | #define g_ExtraMsg_Simple(speed, elapsed, left) \ 49 | g_speed_tr + QString::number(speed) + QLatin1String("/s\n") + g_elapsed_remain_tr.arg(elapsed/1000.,0,'f',1).arg(left,0,'f',1) 50 | //QString("%1%2/s\n%3").arg(g_speed_tr).arg(speed).arg(g_elapsed_remain_tr.arg(elapsed/1000.,0,'f',1).arg(left,0,'f',1)) 51 | 52 | #define g_BaseMsg_Ratio(file, size, ratio, processed, max_str) \ 53 | file + QLatin1String("\n") + g_size_tr + QLatin1String(size2str(size)) + g_ratio_tr + ratio + QLatin1String("\n") + g_processed_tr + QLatin1String(size2str(processed)) + max_str + QLatin1String("\n") 54 | //QString("%1\n%2%3 %4%5\n%6%7%8\n").arg(file).arg(g_size_tr, g_align_length).arg(size2str(size)).arg(g_ratio_tr).arg(ratio).arg(g_processed_tr, g_align_length).arg(size2str(processed)).arg(max) 55 | 56 | #define g_ExtraMsg_Ratio(speed, elapsed, left) \ 57 | g_ExtraMsg_Detail(speed, elapsed, left) 58 | #else 59 | 60 | //QString().sprintf(); alignment; %-*s: max len of g_xxx_tr 61 | #define g_BaseMsg_Detail(file, size, processed, max_str) \ 62 | QString("%1\n%2%3\n%4%5%6\n").arg(file).arg(g_size_tr, g_align_length).arg(size2str(size)).arg(g_processed_tr, g_align_length).arg(size2str(processed)).arg(max_str) 63 | //QString().sprintf("%s\n%-6s%s\n%-6s%s%s", qPrintable(file), qPrintable(g_size_tr), size2str(size), qPrintable(g_processed_tr), size2str(processed), qPrintable(max)) 64 | // QString("%1\n%2%3\n%4%5%6\n").arg(file, g_size_tr, size2str(size), g_processed_tr, size2str(processed), max) 65 | //QObject::tr("%1\nSize:%2%3\n%4%5%6\n") 66 | #define g_ExtraMsg_Detail(speed, elapsed, left) \ 67 | QString("%1%2/s\n%3").arg(g_speed_tr).arg(size2str(speed)).arg(g_elapsed_remain_tr.arg(elapsed/1000.,0,'f',1).arg(left,0,'f',1)) 68 | // QString("%1%2/s\n%3").arg(g_speed_tr, size2str(speed), g_elapsed_remain_tr.arg(elapsed/1000.,0,'f',1).arg(left,0,'f',1)) 69 | 70 | //slower? 71 | #define g_BaseMsg_Simple(file, value, max_str) \ 72 | QString("%1\n%2%3%4\n").arg(file).arg(g_processed_tr).arg(value).arg(max_str).arg(g_files_tr) 73 | // QString("%1\n%2%3%4\n").arg(file, g_processed_tr, QString::number(value), max_str, g_files_tr) 74 | #define g_ExtraMsg_Simple(speed, elapsed, left) \ 75 | QString("%1%2/s\n%3").arg(g_speed_tr).arg(speed).arg(g_elapsed_remain_tr.arg(elapsed/1000.,0,'f',1).arg(left,0,'f',1)) 76 | // QString("%1%2/s\n%3").arg(g_speed_tr, QString::number(speed), g_elapsed_remain_tr.arg(elapsed/1000.,0,'f',1).arg(left,0,'f',1)) 77 | 78 | #define g_BaseMsg_Ratio(file, size, ratio, processed, max_str) \ 79 | QString("%1\n%2%3 %4%5\n%6%7%8\n").arg(file).arg(g_size_tr, g_align_length).arg(size2str(size)).arg(g_ratio_tr).arg(ratio).arg(g_processed_tr, g_align_length).arg(size2str(processed)).arg(max_str) 80 | // QString("%1\n%2%3 %4%5\n%6%7%8\n").arg(file, g_size_tr, size2str(size), g_ratio_tr, ratio, g_processed_tr, size2str(processed), max) 81 | 82 | #define g_ExtraMsg_Ratio(speed, elapsed, left) \ 83 | g_ExtraMsg_Detail(speed, elapsed, left) 84 | //QString("%1%2/s\n%3").arg(g_speed_tr, size2str(speed), g_elapsed_remain_tr.arg(elapsed/1000.,0,'f',1).arg(left,0,'f',1)) 85 | 86 | #endif //QT4.6.0 87 | 88 | #endif // SMGDEF_H 89 | -------------------------------------------------------------------------------- /src/option.cpp: -------------------------------------------------------------------------------- 1 | #include "option.h" 2 | #include "qtcompat.h" 3 | #include 4 | #include 5 | #include 6 | #include //HUGE_VAL 7 | 8 | #include "utils/strutil.h" 9 | 10 | void printHelp(); 11 | 12 | void opts_free(opts_t opts) 13 | { 14 | if (!opts) 15 | return; 16 | if (opts->argv) 17 | free(opts->argv); 18 | free(opts); 19 | } 20 | 21 | opts_t opts_parse(int argc, char **argv) 22 | { 23 | int option_index = 0; 24 | const char *short_options = "ai:t:F:mnshHT:x:o:cd::C:"; 25 | int c; 26 | opts_t opts; 27 | 28 | opts = (opts_t)calloc(1, sizeof(*opts)); 29 | if (!opts) { 30 | fprintf(stderr,"%s: option structure allocation failed (%s)",argv[0], strerror(errno)); 31 | fprintf(stderr, "\n"); 32 | return 0; 33 | } 34 | 35 | opts->program_name = argv[0]; 36 | opts->cmd=0; 37 | opts->parser_type="tar"; 38 | opts->time_format = "plain"; 39 | opts->x_file=NULL; 40 | opts->out_dir="./"; 41 | opts->auto_close=0; 42 | opts->help=0; 43 | opts->multi_thread=0; 44 | //opts->program_name="qop"; 45 | opts->interval = 300; 46 | opts->steps=-1; 47 | opts->unit=2; 48 | opts->all_msg = false; 49 | 50 | opts->argc = 0; 51 | opts->argv = (char**)calloc(argc + 1, sizeof(char *)); 52 | if (!opts->argv) { 53 | fprintf(stderr,"%s: option structure argv allocation failed (%s)",argv[0], strerror(errno)); 54 | fprintf(stderr, "\n"); 55 | opts_free(opts); 56 | return 0; 57 | } 58 | 59 | do { 60 | c = getopt_long(argc, argv, short_options, long_options, &option_index); 61 | if (c < 0) continue; 62 | switch (c) { 63 | case 'a': opts->all_msg = true; break; 64 | case 'F': opts->time_format = optarg; break; 65 | case 'i': { 66 | //QRegExp exp("(\\d+)(s|sec|secs|seconds)"); //qt2 is much different 67 | std::string t(optarg); 68 | bool ok = false; 69 | if (str_ends_with(t, "msec") || str_ends_with(t, "msecs")) { 70 | t.erase(t.find("msec"), 5); 71 | int msec = atoi(t.c_str()); 72 | ok = (msec!=INT_MAX && msec!=INT_MIN && msec!=0); 73 | if (ok) 74 | opts->interval = msec; 75 | } else if (str_ends_with(t, "s") || str_ends_with(t, "sec") || str_ends_with(t, "secs") || str_ends_with(t, "seconds")) { 76 | t.erase(t.find("s"), 7); 77 | double s = atof(t.c_str()); 78 | ok = (s!=HUGE_VAL && s!=0.0); 79 | if (ok) 80 | opts->interval = s*1000; 81 | } else { 82 | int msec = atoi(t.c_str()); 83 | ok = (msec!=INT_MAX && msec!=INT_MIN && msec!=0); 84 | if (ok) 85 | opts->interval = msec; 86 | } 87 | if (!ok) 88 | fprintf(stderr, "Wrong time format!\nUse Ns, Nsec, Nsecs, Nseconds, Nmsec, Nmsecs, N"); 89 | break; 90 | } 91 | case 't': opts->parser_type=optarg; break; 92 | case 'm': opts->multi_thread=1; break; 93 | case 'n': opts->unit=1; break; 94 | case 's': opts->unit=0; break; 95 | case 'T': opts->steps=atoi(optarg); break; 96 | case 'h': printHelp(); exit(0);//opts->help=1;break;// 97 | case 'H': opts->hide=1; break; 98 | case 'c': opts->auto_close=1; break; 99 | case 'C': { 100 | //opts->x_file=0; 101 | opts->optind=optind; 102 | //std::string s; 103 | opts->cmd=new char[256]; 104 | opts->cmd[0]=0; 105 | for(int i=optind-1;icmd,argv[i])," "); 107 | //s.append(argv[i]).append(" "); 108 | } 109 | //opts->cmd=const_cast(s.c_str()); 110 | ZDEBUG("cmd: %s",opts->cmd); 111 | return opts; 112 | } 113 | case 'x': opts->x_file=optarg; break; 114 | case 'd': opts->diy=1; if(optarg!=NULL) opts->x_file=optarg; break; 115 | case 'I': opts->Stdin=1; break; 116 | case 'O': opts->Stdout=1; break; 117 | case 'o': opts->out_dir=optarg; break; 118 | case '?': printHelp(); exit(0);//opts->help=1;break;// 119 | default: 120 | break; 121 | } 122 | } while (c != -1); 123 | 124 | opts->optind=optind; 125 | if(opts->x_file!=NULL && strcmp("tar",opts->parser_type)==0) opts->parser_type="untar"; 126 | 127 | return opts; 128 | } 129 | -------------------------------------------------------------------------------- /src/option.h: -------------------------------------------------------------------------------- 1 | #ifndef OPTION_H 2 | #define OPTION_H 3 | 4 | #include 5 | 6 | struct opts_s; 7 | typedef struct opts_s *opts_t; 8 | 9 | //getopt_long_only 10 | const struct option long_options[] = { 11 | {"help", 0, 0, 'h'}, 12 | {"all", 0, 0, 'a'}, 13 | {"size",0,0,'s'}, 14 | {"number",0,0,'n'}, 15 | {"auto-close",0,0,'c'}, 16 | {"cmd",0,0,'C'}, 17 | {"time-format", 1, 0, 'F'}, 18 | {"interval", 1, 0, 'i'}, 19 | {"multi-thread",0,0,'m'}, 20 | {"extract",1,0,'x'}, 21 | {"steps",1,0,'T'}, 22 | {"parser",2,0,'t'}, 23 | {"diy",2,0,'d'}, 24 | {"stdin",0,0,'I'}, 25 | {"stdout",0,0,'O'}, 26 | {"outdir",0,0,'o'}, 27 | {"hide",0,0,'H'}, 28 | {0, 0, 0, 0} 29 | }; 30 | 31 | struct opts_s { 32 | int argc; /* number of non-option arguments */ 33 | char **argv; 34 | char* program_name; 35 | 36 | char* cmd; 37 | 38 | const char* parser_type; 39 | const char* time_format; 40 | bool all_msg; 41 | int interval; 42 | int unit; 43 | int steps; 44 | int multi_thread; 45 | int auto_close; 46 | int hide; 47 | const char* x_file; 48 | const char* out_dir; //default is ./ 49 | int help; 50 | int optind; 51 | 52 | int diy; 53 | int Stdin; 54 | int Stdout; 55 | 56 | }; 57 | 58 | //const char* opts_s::parser_type="tar"; 59 | 60 | extern opts_t opts_parse(int, char **); 61 | extern void opts_free(opts_t); 62 | 63 | 64 | #endif // OPTION_H 65 | -------------------------------------------------------------------------------- /src/qarchive/arcreader.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | ArcReader: Archive information reader 3 | Copyright (C) 2010 Wangbin 4 | (aka. nukin in ccmove & novesky in http://forum.motorolafans.com) 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | ******************************************************************************/ 20 | #include "../qarchive/arcreader.h" 21 | #include "utils/util.h" 22 | #include "qtcompat.h" 23 | #include 24 | #include 25 | 26 | namespace Archive { 27 | 28 | static bool checkData(const Magic& magic,const unsigned char* data) 29 | { 30 | data+=magic.offset; 31 | //char *data_tmp=new char[strlen((char*)magic.data)+1]; 32 | //memcpy(data_tmp,magic.data,strlen((char*)magic.data)); 33 | //!= or == ? 34 | #if ( __BYTE_ORDER != __LITTLE_ENDIAN) 35 | #pragma message("little endian") 36 | reverse((char*)magic.data,strlen((char*)magic.data)); 37 | #endif 38 | //printf("size: %d\n",magic.size()); 39 | bool eq=strncmp((const char*)magic.data,(const char*)data,magic.size())==0; 40 | #if ( __BYTE_ORDER != __LITTLE_ENDIAN) 41 | reverse((char*)magic.data,strlen((char*)magic.data)); 42 | #endif 43 | return eq; 44 | } 45 | 46 | 47 | #if defined(ARCREADER_STL) 48 | ArcReader::ArcReader(const std::string& file) 49 | :fileName(file),format(FormatUnknow) 50 | { 51 | format_map.insert(std::pair(".tar",FormatTar)); 52 | format_map.insert(std::pair(".tgz",FormatGzip)); 53 | format_map.insert(std::pair(".gz",FormatGzip)); 54 | format_map.insert(std::pair(".bz2",FormatBzip2)); 55 | format_map.insert(std::pair(".zip",FormatZip)); 56 | format_map.insert(std::pair(".rar",FormatRar)); 57 | format_map.insert(std::pair(".xz",FormatXz)); 58 | format_map.insert(std::pair(".7z",Format7zip)); 59 | format_map.insert(std::pair(".lz",FormatLzip)); 60 | format_map.insert(std::pair(".tlz",FormatLzip)); 61 | format_map.insert(std::pair(".lzo",FormatLzop)); 62 | format_map.insert(std::pair(".tlzo",FormatLzop)); 63 | format_map.insert(std::pair(".lzma",FormatLzop)); 64 | format_map.insert(std::pair(".tlzma",FormatLzop)); 65 | format_map.insert(std::pair(".lha",FormatLha)); 66 | format_map.insert(std::pair("",FormatUnknow)); 67 | } 68 | 69 | ArcReader::~ArcReader() 70 | { 71 | } 72 | 73 | void ArcReader::setFile(const std::string &file) 74 | { 75 | fileName=file; 76 | } 77 | 78 | Format ArcReader::formatByMagic() 79 | { 80 | format=FormatUnknow; 81 | FILE *file=NULL; 82 | if((file=fopen(fileName.c_str(),"r"))==NULL) 83 | return format; 84 | 85 | unsigned char flag[7]; 86 | if(fread(flag,sizeof(unsigned char),7,file)!=sizeof(unsigned char)*7) return format; 87 | 88 | printf("header: %s\n",flag); 89 | for(int i=0;magics[i].format!=FormatUnknow;++i) { 90 | if(checkData(magics[i],flag)) { 91 | printf("%s archive\n",magics[i].name); 92 | fflush(stdout); 93 | format=magics[i].format; 94 | break; 95 | } 96 | } 97 | fclose(file); 98 | return format; 99 | } 100 | 101 | Format ArcReader::formatByName() 102 | { 103 | size_t pos=fileName.find_last_of("."); 104 | std::string ext=fileName.substr(pos); 105 | format=format_map.find(ext)->second; 106 | return format; 107 | } 108 | 109 | 110 | size_t ArcReader::uncompressedSize() 111 | { 112 | //if(formatByName()==Unknow) 113 | formatByMagic(); 114 | 115 | FILE *file=NULL; 116 | size_t unx_size=0; 117 | if((file=fopen(fileName.c_str(),"r"))==NULL) 118 | goto error_exit; 119 | 120 | if(format==FormatGzip) { 121 | if(fseek(file,-4,SEEK_END)!=0) 122 | goto error_exit; 123 | } else if(format==FormatZip) { 124 | if(fseek(file,22,SEEK_SET)!=0) 125 | goto error_exit; 126 | //char bt[4]; 127 | //fread(bt,1,4,file); 128 | //printf("Uncompressed zip=%s\n",bt); 129 | //fseek(file,22,SEEK_SET); 130 | } else if(format==FormatRar) { 131 | if(fseek(file,sizeof(char*)+sizeof(unsigned short)+sizeof(unsigned long),SEEK_SET)!=0) 132 | goto error_exit; 133 | } 134 | 135 | fread(&unx_size,sizeof(size_t),1,file); 136 | swap_endian((char*)&unx_size,sizeof(size_t)); 137 | 138 | 139 | printf("Uncompressed size=%d\n",unx_size); 140 | fflush(stdout); 141 | error_exit: 142 | if(file) 143 | fclose(file); 144 | return unx_size; 145 | 146 | } 147 | 148 | #else 149 | 150 | QArcReader::QArcReader(const QString& file) 151 | :fileName(file),format(FormatUnknow) 152 | { 153 | //SymToStr(s) #s 154 | //for in Format ..insert(SymToStr(s),s) 155 | format_map.insert(".tar",FormatTar); 156 | format_map.insert(".tgz",FormatGzip); 157 | format_map.insert(".gz",FormatGzip); 158 | format_map.insert(".bz2",FormatBzip2); 159 | format_map.insert(".zip",FormatZip); 160 | format_map.insert(".rar",FormatRar); 161 | format_map.insert(".xz",FormatXz); 162 | format_map.insert(".7z",Format7zip); 163 | format_map.insert(".lz",FormatLzip); 164 | format_map.insert(".tlz",FormatLzip); 165 | format_map.insert(".lzo",FormatLzop); 166 | format_map.insert(".tlzo",FormatLzop); 167 | format_map.insert(".lzma",FormatLzop); 168 | format_map.insert(".tlzma",FormatLzop); 169 | format_map.insert(".lzh",FormatLha); 170 | format_map.insert("",FormatUnknow); 171 | } 172 | 173 | QArcReader::~QArcReader() 174 | {} 175 | 176 | void QArcReader::setFile(const QString &file) 177 | { 178 | fileName=file; 179 | } 180 | 181 | Format QArcReader::formatByMagic() 182 | { 183 | format=FormatUnknow; 184 | QFile file(fileName); 185 | #if ARCREADER_QT4 186 | if(!file.open(QIODevice::ReadOnly)) { 187 | file.error(); 188 | #else 189 | if(file.open(IO_ReadOnly)) { 190 | qDebug("open error"); 191 | #endif//ARCREADER_QT4 192 | return format; 193 | } 194 | 195 | unsigned char flag[7]; 196 | #if ARCREADER_QT4 197 | file.read((char*)flag,7); 198 | #else 199 | file.readBlock((char*)flag,7); 200 | #endif //ARCREADER_QT4 201 | printf("header: %s\n",flag); 202 | for(int i=0;magics[i].format!=FormatUnknow;++i) { 203 | if(checkData(magics[i],flag)) { 204 | printf("%s archive, %d\n",magics[i].name,i); 205 | fflush(stdout); 206 | format=magics[i].format; 207 | break; 208 | } 209 | } 210 | file.close();; 211 | return format; 212 | } 213 | 214 | Format QArcReader::formatByName() 215 | { 216 | int pos= 217 | #if ARCREADER_QT4 218 | fileName.lastIndexOf("."); 219 | #else 220 | fileName.findRev("."); 221 | #endif //size_t pos 222 | format=format_map[fileName.mid(pos)]; 223 | return format; 224 | } 225 | 226 | size_t QArcReader::uncompressedSize() 227 | { 228 | formatByMagic(); 229 | QFile file(fileName); 230 | size_t unx_size=file.size(); 231 | #if ARCREADER_QT4 232 | if(!file.open(QIODevice::ReadOnly)) { 233 | file.error(); 234 | #else 235 | if(file.open(IO_ReadOnly)) { 236 | qDebug("open error"); 237 | #endif//ARCREADER_QT4 238 | return unx_size; 239 | } 240 | 241 | uint pos=0; 242 | if(format==FormatGzip) pos=file.size()-4; 243 | else if(format==FormatZip) pos=22; 244 | else if(format==FormatRar) { 245 | //printf("ch* %d us %d ul %d ",sizeof(char*),sizeof(unsigned short),sizeof(unsigned long)); 246 | pos=sizeof(char*)+sizeof(unsigned short)+sizeof(unsigned long); 247 | } else if(format==FormatLha) pos=11; 248 | 249 | #if ARCREADER_QT4 250 | if(!file.seek(pos)) { 251 | #else 252 | if(!file.at(pos)) { 253 | #endif //ARCREADER_QT4 254 | file.close(); 255 | return unx_size; 256 | } 257 | 258 | #if ARCREADER_QT4 259 | file.read((char*)&unx_size,4); 260 | #else 261 | file.readBlock((char*)&unx_size,4); 262 | #endif //ARCREADER_QT4 263 | file.close(); 264 | #if BYTE_ORDER == LITTLE_ENDIAN 265 | if(format==FormatZip) reverse(reinterpret_cast(&unx_size),4);//swap_endian(reinterpret_cast(&unx_size),4);// 266 | #endif 267 | ZDEBUG("Uncompressed size=%d",unx_size); 268 | 269 | return unx_size; 270 | } 271 | 272 | #endif //ARCREADER_STL 273 | 274 | } 275 | -------------------------------------------------------------------------------- /src/qarchive/arcreader.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | ArcReader: Archive information reader 3 | Copyright (C) 2010 Wangbin 4 | (aka. nukin in ccmove & novesky in http://forum.motorolafans.com) 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | ******************************************************************************/ 20 | #ifndef ARCREADER_H 21 | #define ARCREADER_H 22 | 23 | //default is Qt 24 | //#define ARCREADER_QT 25 | //#define ARCREADER_STL 26 | #if defined(ARCREADER_QT) 27 | # ifdef ARCREADER_STL 28 | # undef ARCREADER_STL 29 | # endif //ARCREADER_STL 30 | #elif defined(ARCREADER_STL) 31 | # ifdef ARCREADER_QT 32 | # undef ARCREADER_QT 33 | # endif //ARCREADER_QT 34 | #else 35 | # define ARCREADER_QT 36 | #endif 37 | 38 | 39 | #ifdef ARCREADER_STL 40 | #include 41 | #include 42 | #include 43 | #else 44 | #include 45 | #include 46 | #if QT_VERSION >= 0x040000 47 | # define ARCREADER_QT4 1 48 | #else 49 | # define ARCREADER_QT4 0 50 | #endif 51 | #endif //ARCREADER_STL 52 | 53 | /*! Endian: busybox/include/platform.h*/ 54 | //#if defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64) || defined(__i386__) || defined(__x86_64__) 55 | #if __BYTE_ORDER == __LITTLE_ENDIAN 56 | //#pragma message("little endian") 57 | //#define LITTLE_ENDIAN 1 58 | //#define BIG_ENDIAN 0 59 | #endif 60 | /* 61 | #ifndef LITTLE_ENDIAN 62 | #undef BIG_ENDIAN 63 | #define BIG_ENDIAN 0 64 | #define LITTLE_ENDIAN !(BIG_ENDIAN) 65 | #endif 66 | #undef BYTE_ORDER 67 | #if ( BIG_ENDIAN>0 ) 68 | #define BYTE_ORDER BIG_ENDIAN 69 | #else 70 | #define BYTE_ORDER LITTLE_ENDIAN 71 | #endif 72 | */ 73 | //#include 74 | namespace Archive { 75 | 76 | enum Format { 77 | FormatArj, FormatZip, FormatRar, FormatTar, FormatGzip, FormatBzip2, \ 78 | Format7zip, FormatLzip, FormatLzop, FormatXz, FormatLzma, FormatLha, FormatUnknow 79 | }; 80 | 81 | struct Magic { 82 | const char* name; 83 | Format format; 84 | unsigned char data[8]; //how to use container 85 | size_t offset; 86 | 87 | //a const object can only call const/static functions. checkData(const Magic&,uchar*); 88 | size_t size() const { return strlen((const char*)data)/sizeof(unsigned char);} 89 | }; 90 | 91 | /*! 92 | typedef unsigned char UBYTE; 93 | typedef unsigned short UWORD; 94 | typedef unsigned long UDWORD; 95 | struct RAR20_archive_entry 96 | { //stored in RAR v2.0 archives 97 | char *Name; 98 | UWORD NameSize; 99 | UDWORD PackSize; 100 | UDWORD UnpSize; 101 | UBYTE HostOS; // MSDOS=0,OS2=1,WIN32=2,UNIX=3 102 | UDWORD FileCRC; 103 | UDWORD FileTime; 104 | UBYTE UnpVer; 105 | UBYTE Method; 106 | UDWORD FileAttr; 107 | }; 108 | */ 109 | //extern const Magic magics[]; 110 | const Magic magics[]={ 111 | {"gzip", FormatGzip, { 0x1f, 0x8b }, 0}, 112 | {"zip", FormatZip, { 0x50, 0x4b, 0x03, 0x04 }, 0}, //PK 113 | {"zip-outdated",FormatZip, { 0x50, 0x40, 0x30, 0x30 }, 0}, 114 | {"rar", FormatRar, { 0x52, 0x61, 0x72, 0x21 }, 0},//{"rar",Rar,{'R','a','r','!'},0}, 115 | {"bzip2", FormatBzip2, { 0x42, 0x5A, 0x68 }, 0}, //{"bzip2",Bzip2,{'B','Z','h'},0}, 116 | {"7-zip", Format7zip, { 0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C }, 0},//{"7-zip",_7zip,{'7','z','集','''},0}, //0x377ABCAF271CLL) //"7z...." 117 | {"xz", FormatXz, { 0xfd, 0x37, 0x7A, 0x58, 0x5A }, 0}, //{"xz",Xz,{0xfd,'7','z','X','Z'},0}, 118 | {"lzip", FormatLzip, {'L','Z','I','P'}, 0}, 119 | //{"lzma", FormatLzma, {'L','Z','I','P'}, 0}, 120 | {"lzo", FormatLzop, { 0x00, 0xe9, 0x4c, 0x5a, 0x4f, 0xff, 0x1a }, 0}, 121 | {"arj", FormatArj, { 0x06, 0xEA }, 0}, 122 | {"lha-lh0", FormatLha, {'-','l','h','0','-'}, 2}, 123 | {"lha-lh1", FormatLha, {'-','l','h','1','-'}, 2}, 124 | {"lha-lh2", FormatLha, {'-','l','h','2','-'}, 2}, 125 | {"lha-lh3", FormatLha, {'-','l','h','3','-'}, 2}, 126 | {"lha-lh4", FormatLha, {'-','l','h','4','-'}, 2}, 127 | {"lha-lh5", FormatLha, {'-','l','h','5','-'}, 2}, 128 | {"lha-lh6", FormatLha, {'-','l','h','6','-'}, 2}, 129 | {"lha-lh7", FormatLha, {'-','l','h','7','-'}, 2}, 130 | {"lha-lz4", FormatLha, {'-','l','z','4','-'}, 2}, 131 | {"lha-lz5", FormatLha, {'-','l','z','5','-'}, 2}, 132 | {"lha-lzs", FormatLha, {'-','l','z','s','-'}, 2}, 133 | {"unknow", FormatUnknow, {}, 0} 134 | 135 | }; 136 | 137 | 138 | #ifdef ARCREADER_STL 139 | typedef std::map FormatMap; 140 | 141 | class ArcReader 142 | { 143 | public: 144 | ArcReader(const std::string& file=0); 145 | ~ArcReader(); 146 | 147 | void setFile(const std::string& file); 148 | Format formatByMagic(); 149 | Format formatByName(); 150 | 151 | size_t uncompressedSize(); 152 | 153 | private: 154 | FormatMap format_map; 155 | std::string fileName; 156 | Format format; 157 | 158 | }; 159 | 160 | typedef ArcReader QArcReader; 161 | /*struct extention_map { 162 | std::string ext; 163 | Format format; 164 | };*/ 165 | #else 166 | /*struct extention_map { 167 | QString ext; 168 | Format format; 169 | };*/ 170 | typedef QMap FormatMap; 171 | 172 | class QArcReader 173 | { 174 | public: 175 | QArcReader(const QString& file=0); 176 | ~QArcReader(); 177 | 178 | void setFile(const QString& file); 179 | Format formatByMagic(); 180 | Format formatByName(); 181 | 182 | size_t uncompressedSize(); 183 | 184 | private: 185 | FormatMap format_map; 186 | QString fileName; 187 | Format format; 188 | }; 189 | 190 | typedef QArcReader ArcReader; 191 | 192 | #endif //ARCREADER_STL 193 | } //namespace Archive 194 | 195 | #endif // ARCREADER_H 196 | -------------------------------------------------------------------------------- /src/qarchive/gzip/GzipHeader.h: -------------------------------------------------------------------------------- 1 | #ifndef GZIPHEADER_H 2 | #define GZIPHEADER_H 3 | 4 | namespace Archive { 5 | namespace Gzip { 6 | 7 | const UInt16 kSignature = 0x8B1F; 8 | 9 | namespace Header 10 | { 11 | namespace Flags 12 | { 13 | const Byte kIsText = 1 << 0; 14 | const Byte kCrc = 1 << 1; 15 | const Byte kExtra = 1 << 2; 16 | const Byte kName = 1 << 3; 17 | const Byte kComment = 1 << 4; 18 | } 19 | 20 | namespace ExtraFlags 21 | { 22 | const Byte kMaximum = 2; 23 | const Byte kFastest = 4; 24 | } 25 | 26 | namespace CompressionMethod 27 | { 28 | const Byte kDeflate = 8; 29 | } 30 | 31 | namespace HostOS 32 | { 33 | enum EEnum 34 | { 35 | kFAT = 0, 36 | kAMIGA, 37 | kVMS, 38 | kUnix, 39 | kVM_CMS, 40 | kAtari, 41 | kHPFS, 42 | kMac, 43 | kZ_System, 44 | kCPM, 45 | kTOPS20, 46 | kNTFS, 47 | kQDOS, 48 | kAcorn, 49 | kVFAT, 50 | kMVS, 51 | kBeOS, 52 | kTandem, 53 | 54 | kUnknown = 255 55 | }; 56 | } 57 | } 58 | }} 59 | 60 | #endif // GZIPHEADER_H 61 | -------------------------------------------------------------------------------- /src/qarchive/gzip/GzipItem.cpp: -------------------------------------------------------------------------------- 1 | #include "GzipItem.h" 2 | 3 | -------------------------------------------------------------------------------- /src/qarchive/gzip/GzipItem.h: -------------------------------------------------------------------------------- 1 | #ifndef GZIPITEM_H 2 | #define GZIPITEM_H 3 | 4 | #include "Types.h" 5 | #include "GzipHeader.h" 6 | #include 7 | 8 | namespace Archive { 9 | namespace Gzip { 10 | 11 | const char * const kHostOSes[] = 12 | { 13 | "FAT", 14 | "AMIGA", 15 | "VMS", 16 | "Unix", 17 | "VM/CMS", 18 | "Atari", 19 | "HPFS", 20 | "Macintosh", 21 | "Z-System", 22 | "CP/M", 23 | "TOPS-20", 24 | "NTFS", 25 | "SMS/QDOS", 26 | "Acorn", 27 | "VFAT", 28 | "MVS", 29 | "BeOS", 30 | "Tandem", 31 | "OS/400", 32 | "OS/X" 33 | }; 34 | 35 | const char* const kUnknownOS = "Unknown"; 36 | 37 | class Item 38 | { 39 | bool TestFlag(Byte flag) const { return (Flags & flag) != 0; } 40 | public: 41 | Byte Method; 42 | Byte Flags; 43 | Byte ExtraFlags; 44 | Byte HostOS; 45 | UInt32 Time; 46 | UInt32 Crc; 47 | UInt32 Size32; 48 | 49 | QString Name; 50 | QString Comment; 51 | // CByteBuffer Extra; 52 | 53 | // bool IsText() const { return TestFlag(NHeader::NFlags::kIsText); } 54 | bool HeaderCrcIsPresent() const { return TestFlag(Header::Flags::kCrc); } 55 | bool ExtraFieldIsPresent() const { return TestFlag(Header::Flags::kExtra); } 56 | bool NameIsPresent() const { return TestFlag(Header::Flags::kName); } 57 | bool CommentIsPresent() const { return TestFlag(Header::Flags::kComment); } 58 | 59 | void Clear() 60 | { 61 | Name.isEmpty(); 62 | Comment.isEmpty(); 63 | // Extra.SetCapacity(0); 64 | } 65 | /* 66 | HRESULT ReadHeader(NCompress::NDeflate::NDecoder::CCOMCoder *stream); 67 | HRESULT ReadFooter1(NCompress::NDeflate::NDecoder::CCOMCoder *stream); 68 | HRESULT ReadFooter2(ISequentialInStream *stream); 69 | 70 | HRESULT WriteHeader(ISequentialOutStream *stream); 71 | HRESULT WriteFooter(ISequentialOutStream *stream); 72 | */ 73 | }; 74 | }} 75 | 76 | #endif // GZIPITEM_H 77 | -------------------------------------------------------------------------------- /src/qarchive/qarchive.cpp: -------------------------------------------------------------------------------- 1 | #include "qarchive.h" 2 | #include "qarchive_p.h" 3 | #include 4 | #if defined(linux) || defined(__linux) || defined(__linux__) 5 | #include 6 | #include 7 | #endif 8 | #include "utils/convert.h" 9 | #include "utils/qt_util.h" 10 | #include "msgdef.h" 11 | 12 | //namespace Archive { 13 | /* 14 | #if (QT_VERSION >= 0x040000) 15 | QFile::Permissions modeToPermissions(unsigned int mode) 16 | { 17 | QFile::Permissions ret; 18 | if (mode & S_IRUSR) 19 | ret |= QFile::ReadOwner; 20 | if (mode & S_IWUSR) 21 | ret |= QFile::WriteOwner; 22 | if (mode & S_IXUSR) 23 | ret |= QFile::ExeOwner; 24 | if (mode & S_IRUSR) 25 | ret |= QFile::ReadUser; 26 | if (mode & S_IWUSR) 27 | ret |= QFile::WriteUser; 28 | if (mode & S_IXUSR) 29 | ret |= QFile::ExeUser; 30 | if (mode & S_IRGRP) 31 | ret |= QFile::ReadGroup; 32 | if (mode & S_IWGRP) 33 | ret |= QFile::WriteGroup; 34 | if (mode & S_IXGRP) 35 | ret |= QFile::ExeGroup; 36 | if (mode & S_IROTH) 37 | ret |= QFile::ReadOther; 38 | if (mode & S_IWOTH) 39 | ret |= QFile::WriteOther; 40 | if (mode & S_IXOTH) 41 | ret |= QFile::ExeOther; 42 | return ret; 43 | } 44 | 45 | unsigned int permissionsToMode(QFile::Permissions perms) 46 | { 47 | quint32 mode = 0; 48 | if (perms & QFile::ReadOwner) 49 | mode |= S_IRUSR; 50 | if (perms & QFile::WriteOwner) 51 | mode |= S_IWUSR; 52 | if (perms & QFile::ExeOwner) 53 | mode |= S_IXUSR; 54 | if (perms & QFile::ReadUser) 55 | mode |= S_IRUSR; 56 | if (perms & QFile::WriteUser) 57 | mode |= S_IWUSR; 58 | if (perms & QFile::ExeUser) 59 | mode |= S_IXUSR; 60 | if (perms & QFile::ReadGroup) 61 | mode |= S_IRGRP; 62 | if (perms & QFile::WriteGroup) 63 | mode |= S_IWGRP; 64 | if (perms & QFile::ExeGroup) 65 | mode |= S_IXGRP; 66 | if (perms & QFile::ReadOther) 67 | mode |= S_IROTH; 68 | if (perms & QFile::WriteOther) 69 | mode |= S_IWOTH; 70 | if (perms & QFile::ExeOther) 71 | mode |= S_IXOTH; 72 | return mode; 73 | } 74 | 75 | #endif //ARCREADER_QT4 76 | */ 77 | namespace Archive { 78 | 79 | QArchive::QArchive(const QString &archive) 80 | :d_ptr(new QArchivePrivate) 81 | #if !USE_SLOT 82 | progressHandler(new IProgressHandler) 83 | #endif 84 | { 85 | initTranslations(); 86 | setArchive(archive); 87 | Q_D(QArchive); 88 | d->time.start(); 89 | } 90 | 91 | QArchive::~QArchive() 92 | { 93 | if(d_ptr) { 94 | delete d_ptr; 95 | d_ptr = 0; 96 | } 97 | if(isOpen()) close(); 98 | } 99 | 100 | #if !USE_SLOT 101 | void QArchive::setProgressHandler(IProgressHandler *ph) 102 | { 103 | progressHandler=ph; 104 | } 105 | #endif 106 | void QArchive::createDir(const QString& pathname, int mode) 107 | { 108 | Q_D(QArchive); 109 | QDir(d->outDir).mkdir(pathname); 110 | } 111 | 112 | /* Create a file, including parent directory as necessary. */ 113 | void QArchive::createFile(const QString& pathname, int /*mode*/) 114 | { 115 | Q_D(QArchive); 116 | #if CONFIG_QT4 117 | d->outFile.setFileName(d->outDir+"/"+pathname); 118 | if(!d->outFile.open(QIODevice::ReadWrite)) { 119 | #else 120 | d->outFile.setName(d->outDir+"/"+pathname); 121 | if(!d->outFile.open(IO_ReadWrite)) { 122 | #endif 123 | ezDebug(d->outDir+"/"+pathname); 124 | if(pathname.left(1)=="/") { 125 | QDir(d->outDir).mkdir(pathname.mid(1)); 126 | } else QDir(d->outDir).mkdir(pathname); 127 | } else { 128 | #if CONFIG_QT4 129 | //d->outFile.setPermissions(); 130 | #endif 131 | } 132 | } 133 | 134 | void QArchive::timerEvent(QTimerEvent *) 135 | { 136 | updateMessage();//estimate(); 137 | checkTryPause(); 138 | } 139 | 140 | void QArchive::terminate() 141 | { 142 | ZDEBUG("terminated!"); 143 | exit(0); 144 | } 145 | 146 | void QArchive::pauseOrContinue() 147 | { 148 | Q_D(QArchive); 149 | d->pause = !d->pause; 150 | if(!d->pause) { 151 | d->last_elapsed = d->elapsed; 152 | d->time.restart(); 153 | } 154 | } 155 | 156 | void QArchive::updateMessage() 157 | { 158 | Q_D(QArchive); 159 | d->estimate(); 160 | d->out_msg = g_BaseMsg_Detail(d->current_fileName, d->size, d->processedSize, d->max_str); 161 | d->extra_msg = g_ExtraMsg_Detail(d->speed, d->elapsed, d->left); 162 | emit textChanged(d->out_msg+d->extra_msg); 163 | qApp->processEvents(); 164 | } 165 | 166 | void QArchive::finishMessage() 167 | { 168 | Q_D(QArchive); 169 | d->estimate(); 170 | d->out_msg=QObject::tr("Finished: ") + QString::number(d->numFiles)+ QLatin1String(" ") +QObject::tr("files") + QLatin1String("\n") + QString(size2str(d->processedSize))+d->max_str + QLatin1String("\n"); 171 | d->extra_msg=QObject::tr("Speed: ") + QString(size2str(d->processedSize/(1+d->elapsed)*1000)) + QLatin1String("/s\n") + QObject::tr("Elapsed: %1s Remaining: %2s").arg(g_time_convert(d->elapsed)).arg(g_time_convert(d->left)); 172 | killTimer(d->tid); 173 | emit finished(); 174 | emit textChanged(d->out_msg+d->extra_msg); 175 | qApp->processEvents(); 176 | } 177 | 178 | void QArchive::forceShowMessage(int interval) 179 | { 180 | Q_D(QArchive); 181 | if(d->time.elapsed()-d->time_passed>interval) { 182 | d->time_passed = d->time.elapsed(); 183 | updateMessage(); 184 | } 185 | } 186 | 187 | void QArchive::checkTryPause() 188 | { 189 | Q_D(QArchive); 190 | while(d->pause) { 191 | QT_UTIL::qWait(100); 192 | } 193 | } 194 | 195 | void QArchive::setInterval(unsigned int interval) 196 | { 197 | Q_D(QArchive); 198 | d->interval = interval; 199 | } 200 | 201 | void QArchive::setOutDir(const QString &odir) 202 | { 203 | Q_D(QArchive); 204 | d->outDir = odir; 205 | if(!QDir(d->outDir).exists()) { 206 | ZDEBUG("out dir %s doesn't exist. creating...",qPrintable(d->outDir)); 207 | QDir().mkdir(d->outDir); 208 | } 209 | } 210 | 211 | QString QArchive::outDir() const 212 | { 213 | //Q_D(QArchive); 214 | return d_ptr->outDir; 215 | } 216 | 217 | void QArchive::setArchive(const QString &name) 218 | { 219 | //QFileInfo(name).absoluteFilePath(); 220 | if(isOpen()) 221 | close(); 222 | #if (QT_VERSION >= 0x040000) 223 | setFileName(name); 224 | #else 225 | this->QFile::setName(name); 226 | #endif 227 | Q_D(QArchive); 228 | d->totalSize = size(); 229 | d->max_str=QString(" / %1").arg(size2str(d->totalSize)); 230 | } 231 | 232 | uint QArchive::unpackedSize() 233 | { 234 | Q_D(QArchive); 235 | return d->totalSize; 236 | } 237 | 238 | Archive::Error QArchive::extract() 239 | { 240 | Q_D(QArchive); 241 | d->time.restart(); 242 | d->tid = startTimer(d->interval); //startTimer(0) error in ezx 243 | return Archive::NoError; 244 | } 245 | } 246 | //} 247 | -------------------------------------------------------------------------------- /src/qarchive/qarchive.h: -------------------------------------------------------------------------------- 1 | #ifndef QARCHIVE_H 2 | #define QARCHIVE_H 3 | 4 | #include "qtcompat.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #if QT_VERSION >= 0x040000 12 | # define ARCREADER_QT4 1 13 | #else 14 | # define ARCREADER_QT4 0 15 | #endif 16 | /* 17 | #if defined(Q_OS_WIN) 18 | # undef S_IFREG 19 | # define S_IFREG 0100000 20 | # ifndef S_IFDIR 21 | # define S_IFDIR 0040000 22 | # endif 23 | # ifndef S_ISDIR 24 | # define S_ISDIR(x) ((x) & S_IFDIR) > 0 25 | # endif 26 | # ifndef S_ISREG 27 | # define S_ISREG(x) ((x) & 0170000) == S_IFREG 28 | # endif 29 | # define S_IFLNK 020000 30 | # define S_ISLNK(x) ((x) & S_IFLNK) > 0 31 | # ifndef S_IRUSR 32 | # define S_IRUSR 0400 33 | # endif 34 | # ifndef S_IWUSR 35 | # define S_IWUSR 0200 36 | # endif 37 | # ifndef S_IXUSR 38 | # define S_IXUSR 0100 39 | # endif 40 | # define S_IRGRP 0040 41 | # define S_IWGRP 0020 42 | # define S_IXGRP 0010 43 | # define S_IROTH 0004 44 | # define S_IWOTH 0002 45 | # define S_IXOTH 0001 46 | #endif 47 | 48 | #if QT_VERSION >= 0x040000 49 | extern unsigned int permissionsToMode(QFile::Permissions perms); 50 | extern QFile::Permissions modeToPermissions(unsigned int mode); 51 | #endif 52 | */ 53 | 54 | #define USE_SLOT 1 55 | 56 | typedef struct 57 | { 58 | void (*Progress)(const QString&, size_t current_size, size_t processed, size_t total_size, int speed, int time_elapsed, int time_remain); 59 | } IProgressHandler; 60 | 61 | namespace Archive { 62 | 63 | enum Error { 64 | OpenError, ReadError, WriteError, ChecksumError, End, NoError 65 | }; 66 | 67 | class QArchivePrivate; 68 | class QArchive : 69 | #if !(QT_VERSION >= 0x040000) 70 | public QObject, 71 | #endif 72 | public QFile 73 | { 74 | Q_OBJECT 75 | public: 76 | QArchive(const QString& file=""); 77 | virtual ~QArchive()=0; 78 | 79 | void setProgressHandler(IProgressHandler* ph); 80 | void setInterval(unsigned int interval); 81 | void setOutDir(const QString& odir); 82 | QString outDir() const; 83 | void setArchive(const QString& name); 84 | 85 | virtual Error extract(const QString& archive,const QString& dir=".")=0; 86 | virtual Error extract(); 87 | virtual bool verifyChecksum(const char*)=0; 88 | 89 | virtual uint unpackedSize(); 90 | 91 | void updateMessage(); 92 | void finishMessage(); 93 | //since the gui will be blocked while writng files, we must call forceShowMessage() to show text every interval ms. 94 | void forceShowMessage(int interval=1000); 95 | void checkTryPause(); 96 | 97 | void createDir(const QString& pathname, int mode); //move to parent 98 | void createFile(const QString& pathname, int mode); //move to parent 99 | 100 | signals: 101 | void byteProcessed(int size); //size_t 102 | void textChanged(const QString&); 103 | void finished(); 104 | 105 | public slots: 106 | void pauseOrContinue(); 107 | void terminate(); 108 | 109 | protected: 110 | Q_DECLARE_PRIVATE(QArchive) 111 | #if !INHERIT_PRIVATE || (QT_VERSION < 0x040000) 112 | QArchivePrivate* d_ptr; 113 | #endif 114 | virtual void timerEvent(QTimerEvent *); 115 | 116 | IProgressHandler *progressHandler; 117 | }; 118 | 119 | } 120 | 121 | #endif // QARCHIVE_H 122 | -------------------------------------------------------------------------------- /src/qarchive/qarchive_p.h: -------------------------------------------------------------------------------- 1 | #ifndef QARCHIVE_P_H 2 | #define QARCHIVE_P_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace Archive { 9 | 10 | class QArchivePrivate 11 | { 12 | public: 13 | QArchivePrivate():outDir("."),totalSize(0),processedSize(0),size(0),extra_msg(QObject::tr("Calculating...")) \ 14 | ,last_elapsed(1),elapsed(0),time_passed(0),pause(false),numFiles(0),left(0) 15 | { 16 | interval = 300; 17 | /*last_elapsed=1 ensures that elpased = last_elapsed+time.elapsed>0*/ 18 | } 19 | ~QArchivePrivate() { 20 | if(outFile.isOpen()) 21 | outFile.close(); 22 | } 23 | 24 | void estimate() { 25 | if(!pause) elapsed = last_elapsed+time.elapsed(); 26 | speed = processedSize/(1+elapsed)*1000; //>0 27 | left = (qreal)(totalSize-processedSize)/(qreal)(1+speed); 28 | #ifndef NO_EZX 29 | qApp->processEvents(); 30 | #endif //NO_EZX 31 | } 32 | 33 | QString outDir; 34 | QFile outFile; 35 | uint totalSize, processedSize; 36 | uint size, interval; 37 | 38 | QString current_fileName; 39 | QString out_msg, extra_msg; 40 | QString max_str; 41 | uint last_elapsed, elapsed, speed; //ms 42 | int time_passed; 43 | volatile bool pause; 44 | int numFiles; 45 | qreal left; 46 | 47 | int tid; 48 | QTime time; 49 | }; 50 | 51 | } //namespace Archve 52 | #endif // QARCHIVE_P_H 53 | -------------------------------------------------------------------------------- /src/qarchive/tar/TarHeader.h: -------------------------------------------------------------------------------- 1 | #ifndef TARHEADER_H 2 | #define TARHEADER_H 3 | 4 | namespace Archive { 5 | namespace Tar { 6 | 7 | namespace Header { 8 | const unsigned int RecordSize = 512; 9 | const int NameSize = 100; 10 | const int UserNameSize = 32; 11 | const int GroupNameSize = 32; 12 | const int PrefixSize = 155; 13 | 14 | namespace Mode { 15 | const int SetUID = 04000; // Set UID on execution 16 | const int SetGID = 02000; // Set GID on execution 17 | const int SaveText = 01000; // Save text (sticky bit) 18 | } 19 | 20 | namespace Permission { 21 | const int UserRead = 00400; // read by owner 22 | const int UserWrite = 00200; // write by owner 23 | const int UserExecute = 00100; // execute/search by owner 24 | const int GroupRead = 00040; // read by group 25 | const int GroupWrite = 00020; // write by group 26 | const int GroupExecute = 00010; // execute/search by group 27 | const int OtherRead = 00004; // read by other 28 | const int OtherWrite = 00002; // write by other 29 | const int OtherExecute = 00001; // execute/search by other 30 | } 31 | 32 | namespace LinkFlag { 33 | const char kOldNormal = '\0'; // Normal disk file, Unix compatible 34 | const char kNormal = '0'; // Normal disk file 35 | const char kLink = '1'; // Link to previously dumped file 36 | const char kSymbolicLink = '2'; // Symbolic link 37 | const char kCharacter = '3'; // Character special file 38 | const char kBlock = '4'; // Block special file 39 | const char kDirectory = '5'; // Directory 40 | const char kFIFO = '6'; // FIFO special file 41 | const char kContiguous = '7'; // Contiguous file 42 | 43 | const char kDumpDir = 'D'; /* GNUTYPE_DUMPDIR. 44 | data: list of files created by the --incremental (-G) option 45 | Each file name is preceded by either 46 | - 'Y' (file should be in this archive) 47 | - 'N' (file is a directory, or is not stored in the archive.) 48 | Each file name is terminated by a null + an additional null after the last file name. */ 49 | } 50 | 51 | //h: extern char* const var; //const ptr variable value 52 | //cpp: char const *var="xxx" 53 | //h: const char* const var="xxx" //const ptr and value 54 | const char * const CheckSumBlanks = " "; // 8 blanks, no null 55 | const char * const LongLink = "././@LongLink"; 56 | const char * const LongLink2 = "@LongLink"; 57 | 58 | namespace Magic { 59 | const char * const UsTar = "ustar"; // 5 chars 60 | const char * const GNUTar = "GNUtar "; // 7 chars and a null 61 | const char * const Empty = "\0\0\0\0\0\0\0\0"; // 7 chars and a null 62 | } 63 | } 64 | } 65 | 66 | } 67 | #endif // TARHEADER_H 68 | -------------------------------------------------------------------------------- /src/qarchive/tar/TarItem.h: -------------------------------------------------------------------------------- 1 | #ifndef TARITEM_H 2 | #define TARITEM_H 3 | #include "TarHeader.h" 4 | #include "Types.h" 5 | 6 | #include 7 | 8 | namespace Archive { 9 | namespace Tar { 10 | 11 | struct Item 12 | { 13 | QString Name; 14 | UInt64 Size; 15 | 16 | UInt32 Mode; 17 | UInt32 UID; 18 | UInt32 GID; 19 | UInt32 MTime; 20 | UInt32 DeviceMajor; 21 | UInt32 DeviceMinor; 22 | 23 | QString LinkName; 24 | QString User; 25 | QString Group; 26 | 27 | char Magic[8]; 28 | char LinkFlag; 29 | bool DeviceMajorDefined; 30 | bool DeviceMinorDefined; 31 | 32 | //ItemEx>> 33 | UInt64 HeaderPosition; 34 | unsigned LongLinkSize; 35 | UInt64 GetDataPosition() const { return HeaderPosition + LongLinkSize + Header::RecordSize; } 36 | UInt64 GetFullSize() const { return LongLinkSize + Header::RecordSize + Size; } 37 | //< /* For mkdir() */ 4 | #include 5 | #include "../qarchive_p.h" 6 | #include "utils/util.h" 7 | 8 | namespace Archive { 9 | namespace Tar { 10 | 11 | QTar::QTar(const QString &archive) 12 | :QArchive(archive) 13 | { 14 | } 15 | 16 | QTar::~QTar() 17 | { 18 | if(isOpen()) close(); 19 | } 20 | /* 21 | //slower ? 22 | static bool IsRecordLast(const char *buf) 23 | { 24 | for (int i = 0; i < NFileHeader::kRecordSize; i++) 25 | if (buf[i] != 0) 26 | return false; 27 | return true; 28 | } 29 | */ 30 | bool QTar::isEndBuff(const char *buff) 31 | { 32 | int n=511; 33 | for (; n >= 0; --n) 34 | if (buff[n] != '\0') 35 | return false; 36 | return true; 37 | } 38 | 39 | bool QTar::verifyChecksum(const char* p) 40 | { 41 | int n, u = 0; 42 | for (n = 0; n < 512; ++n) { 43 | if (n < 148 || n > 155) 44 | u += ((unsigned char *)p)[n]; 45 | else 46 | u += 0x20; 47 | } 48 | return (u == parseOct(p + 148, 8)); 49 | } 50 | 51 | uint QTar::unpackedSize() 52 | { 53 | Q_D(QArchive); 54 | return d->totalSize; 55 | } 56 | 57 | Error QTar::extract() 58 | { 59 | //ifstream ofstream to seekg() 60 | QArchive::extract(); 61 | 62 | if(!exists()) return Archive::OpenError; 63 | char buff[Header::RecordSize]; 64 | //QFile outFile; 65 | //FILE* f; 66 | size_t bytes_read; 67 | unsigned int filesize; 68 | 69 | #if ARCREADER_QT4 70 | if(!open(QIODevice::ReadOnly)) { 71 | error(); 72 | #else 73 | if(open(IO_ReadOnly)) { 74 | qDebug("open error"); 75 | #endif //ARCREADER_QT4 76 | return Archive::OpenError; 77 | } 78 | Q_D(QArchive); 79 | for (;;) { 80 | #if ARCREADER_QT4 81 | bytes_read = read(buff,Header::RecordSize); 82 | #else 83 | bytes_read = readBlock(buff,Header::RecordSize); 84 | #endif //ARCREADER_QT4 85 | //put them here 86 | emit byteProcessed(d->processedSize+=Header::RecordSize); 87 | d->current_fileName=QFileInfo(buff).fileName(); 88 | 89 | if (bytes_read < Header::RecordSize) { 90 | fprintf(stderr,"Short read. expected 512, got %d\n", bytes_read); 91 | return Archive::ReadError; 92 | } 93 | if (isEndBuff(buff)) { 94 | #if USE_SLOT 95 | emit byteProcessed(d->processedSize+=Header::RecordSize); //header; 96 | #else 97 | estimate(); 98 | progressHandler->Progress(d->current_fileName, d->size, d->processedSize+=Header::RecordSize, d->totalSize, d->speed, d->elapsed, d->left); 99 | #endif 100 | finishMessage(); 101 | return End; 102 | } 103 | if (!verifyChecksum(buff)) { 104 | fprintf(stderr, "Checksum failure\n"); 105 | return ChecksumError; 106 | } 107 | 108 | switch (buff[156]) { 109 | case Header::LinkFlag::kLink : printf(" Ignoring hardlink %s\n", buff); break; 110 | case Header::LinkFlag::kSymbolicLink : printf(" Ignoring symlink %s\n", buff); break; ///////////////////////// 111 | case Header::LinkFlag::kCharacter: printf(" Ignoring character device %s\n", buff); break; 112 | case Header::LinkFlag::kBlock: printf(" Ignoring block device %s\n", buff); break; 113 | case Header::LinkFlag::kDirectory: 114 | createDir(QString::fromLocal8Bit(buff), parseOct(buff + 100, 8)); 115 | filesize = 0; 116 | break; 117 | case Header::LinkFlag::kFIFO: printf(" Ignoring FIFO %s\n", buff); break; 118 | default: 119 | createFile(QString::fromLocal8Bit(buff), parseOct(buff + 100, 8)); 120 | break; 121 | } 122 | 123 | ++d->numFiles; 124 | filesize = parseOct(buff + 124, 12); 125 | d->size = filesize; 126 | #if USE_SLOT 127 | updateMessage(); 128 | #endif 129 | while (filesize > 0) { 130 | checkTryPause(); 131 | #if ARCREADER_QT4 132 | bytes_read = read(buff,Header::RecordSize); 133 | #else 134 | bytes_read = readBlock(buff,Header::RecordSize); 135 | #endif //ARCREADER_QT4 136 | if (bytes_read < Header::RecordSize) { 137 | fprintf(stderr,"Short read. Expected 512, got %d\n",bytes_read); 138 | return Archive::ReadError; 139 | } 140 | if (filesize < Header::RecordSize) bytes_read = filesize; 141 | if (d->outFile.isOpen()) { 142 | #if CONFIG_QT4 143 | if(d->outFile.write(buff,bytes_read)!=bytes_read) { 144 | fprintf(stderr, "[%s] %s @%d: Failed to write %s\n",__FILE__,__PRETTY_FUNCTION__,__LINE__,qPrintable(d->outFile.fileName())); 145 | #else 146 | if(d->outFile.writeBlock(buff,bytes_read)!=bytes_read) { 147 | fprintf(stderr, "[%s] %s @%d: Failed to write %s\n",__FILE__,__PRETTY_FUNCTION__,__LINE__,qPrintable(d->outFile.name())); 148 | #endif 149 | d->outFile.close(); 150 | } 151 | /*if (fwrite(buff, 1, bytes_read, f)!= bytes_read) { 152 | fprintf(stderr, "Failed write\n"); 153 | fclose(f); 154 | f = NULL; 155 | }*/ 156 | } 157 | #if USE_SLOT 158 | forceShowMessage(1000); 159 | emit byteProcessed(d->processedSize+=Header::RecordSize);//bytes_read); 160 | #else 161 | estimate(); 162 | progressHandler->Progress(d->current_fileName, d->size, d->processedSize+=Header::RecordSize, d->totalSize, d->speed, d->elapsed, d->left); 163 | #endif 164 | filesize -= bytes_read; 165 | } 166 | //emit byteProcessed(processedSize+=size); 167 | if(d->outFile.isOpen()) d->outFile.close(); 168 | } 169 | close(); 170 | } 171 | 172 | Archive::Error QTar::extract(const QString& archive,const QString& dir) 173 | { 174 | setArchive(archive); 175 | setOutDir(dir); 176 | 177 | return extract(); 178 | } 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /src/qarchive/tar/qtar.h: -------------------------------------------------------------------------------- 1 | #ifndef QTAR_H 2 | #define QTAR_H 3 | 4 | #include "../qarchive.h" 5 | 6 | namespace Archive { 7 | namespace Tar { 8 | 9 | class QTar : public QArchive 10 | { 11 | Q_OBJECT 12 | public: 13 | QTar(const QString& archive=""); 14 | ~QTar(); 15 | 16 | bool isEndBuff(const char*); 17 | Error extract(const QString& archive,const QString& dir="."); 18 | Error extract(); 19 | bool verifyChecksum(const char*); 20 | uint unpackedSize(); 21 | 22 | }; 23 | } 24 | 25 | } 26 | 27 | #endif // QTAR_H 28 | -------------------------------------------------------------------------------- /src/qarchive/zip/ZipHeader.cpp: -------------------------------------------------------------------------------- 1 | #include "ZipHeader.h" 2 | 3 | namespace Archive { 4 | namespace Zip { 5 | 6 | namespace Signature 7 | { 8 | UInt32 kLocalFileHeader = 0x04034B50 + 1; 9 | UInt32 kDataDescriptor = 0x08074B50 + 1; 10 | UInt32 kCentralFileHeader = 0x02014B50 + 1; 11 | UInt32 kEndOfCentralDir = 0x06054B50 + 1; 12 | UInt32 kZip64EndOfCentralDir = 0x06064B50 + 1; 13 | UInt32 kZip64EndOfCentralDirLocator = 0x07064B50 + 1; 14 | 15 | class CMarkersInitializer 16 | { 17 | public: 18 | CMarkersInitializer() 19 | { 20 | kLocalFileHeader--; 21 | kDataDescriptor--; 22 | kCentralFileHeader--; 23 | kEndOfCentralDir--; 24 | kZip64EndOfCentralDir--; 25 | kZip64EndOfCentralDirLocator--; 26 | } 27 | }; 28 | static CMarkersInitializer g_MarkerInitializer; 29 | } 30 | 31 | }} 32 | 33 | -------------------------------------------------------------------------------- /src/qarchive/zip/ZipHeader.h: -------------------------------------------------------------------------------- 1 | #ifndef ZIPHEADER_H 2 | #define ZIPHEADER_H 3 | 4 | #include "Types.h" 5 | 6 | namespace Archive { 7 | namespace Zip { 8 | 9 | namespace Signature 10 | { 11 | extern UInt32 kLocalFileHeader; 12 | extern UInt32 kDataDescriptor; 13 | extern UInt32 kCentralFileHeader; 14 | extern UInt32 kEndOfCentralDir; 15 | extern UInt32 kZip64EndOfCentralDir; 16 | extern UInt32 kZip64EndOfCentralDirLocator; 17 | 18 | static const UInt32 kMarkerSize = 4; 19 | } 20 | 21 | const UInt32 kEcdSize = 22; 22 | const UInt32 kZip64EcdSize = 44; 23 | const UInt32 kZip64EcdLocatorSize = 20; 24 | /* 25 | struct CEndOfCentralDirectoryRecord 26 | { 27 | UInt16 ThisDiskNumber; 28 | UInt16 StartCentralDirectoryDiskNumber; 29 | UInt16 NumEntriesInCentaralDirectoryOnThisDisk; 30 | UInt16 NumEntriesInCentaralDirectory; 31 | UInt32 CentralDirectorySize; 32 | UInt32 CentralDirectoryStartOffset; 33 | UInt16 CommentSize; 34 | }; 35 | 36 | struct CEndOfCentralDirectoryRecordFull 37 | { 38 | UInt32 Signature; 39 | CEndOfCentralDirectoryRecord Header; 40 | }; 41 | */ 42 | 43 | namespace NFileHeader 44 | { 45 | /* 46 | struct CVersion 47 | { 48 | Byte Version; 49 | Byte HostOS; 50 | }; 51 | */ 52 | 53 | namespace NCompressionMethod 54 | { 55 | enum EType 56 | { 57 | kStored = 0, 58 | kShrunk = 1, 59 | kReduced1 = 2, 60 | kReduced2 = 3, 61 | kReduced3 = 4, 62 | kReduced4 = 5, 63 | kImploded = 6, 64 | kReservedTokenizing = 7, // reserved for tokenizing 65 | kDeflated = 8, 66 | kDeflated64 = 9, 67 | kPKImploding = 10, 68 | 69 | kBZip2 = 12, 70 | kLZMA = 14, 71 | kTerse = 18, 72 | kLz77 = 19, 73 | kJpeg = 0x60, 74 | kWavPack = 0x61, 75 | kPPMd = 0x62, 76 | kWzAES = 0x63 77 | }; 78 | const int kNumCompressionMethods = 11; 79 | const Byte kMadeByProgramVersion = 20; 80 | 81 | const Byte kExtractVersion_Default = 10; 82 | const Byte kExtractVersion_Dir = 20; 83 | const Byte kExtractVersion_ZipCrypto = 20; 84 | const Byte kExtractVersion_Deflate = 20; 85 | const Byte kExtractVersion_Deflate64 = 21; 86 | const Byte kExtractVersion_Zip64 = 45; 87 | const Byte kExtractVersion_BZip2 = 46; 88 | const Byte kExtractVersion_Aes = 51; 89 | const Byte kExtractVersion_LZMA = 63; 90 | const Byte kExtractVersion_PPMd = 63; 91 | 92 | // const Byte kSupportedVersion = 20; 93 | } 94 | 95 | namespace NExtraID 96 | { 97 | enum 98 | { 99 | kZip64 = 0x01, 100 | kNTFS = 0x0A, 101 | kStrongEncrypt = 0x17, 102 | kUnixTime = 0x5455, 103 | kWzAES = 0x9901 104 | }; 105 | } 106 | 107 | namespace NNtfsExtra 108 | { 109 | const UInt16 kTagTime = 1; 110 | enum 111 | { 112 | kMTime = 0, 113 | kATime, 114 | kCTime 115 | }; 116 | } 117 | 118 | namespace NUnixTime 119 | { 120 | enum 121 | { 122 | kMTime = 0, 123 | kATime, 124 | kCTime 125 | }; 126 | } 127 | 128 | const UInt32 kLocalBlockSize = 26; 129 | /* 130 | struct CLocalBlock 131 | { 132 | CVersion ExtractVersion; 133 | 134 | UInt16 Flags; 135 | UInt16 CompressionMethod; 136 | UInt32 Time; 137 | UInt32 FileCRC; 138 | UInt32 PackSize; 139 | UInt32 UnPackSize; 140 | UInt16 NameSize; 141 | UInt16 ExtraSize; 142 | }; 143 | */ 144 | 145 | const UInt32 kDataDescriptorSize = 16; 146 | // const UInt32 kDataDescriptor64Size = 16 + 8; 147 | /* 148 | struct CDataDescriptor 149 | { 150 | UInt32 Signature; 151 | UInt32 FileCRC; 152 | UInt32 PackSize; 153 | UInt32 UnPackSize; 154 | }; 155 | 156 | struct CLocalBlockFull 157 | { 158 | UInt32 Signature; 159 | CLocalBlock Header; 160 | }; 161 | */ 162 | 163 | const UInt32 kCentralBlockSize = 42; 164 | /* 165 | struct CBlock 166 | { 167 | CVersion MadeByVersion; 168 | CVersion ExtractVersion; 169 | UInt16 Flags; 170 | UInt16 CompressionMethod; 171 | UInt32 Time; 172 | UInt32 FileCRC; 173 | UInt32 PackSize; 174 | UInt32 UnPackSize; 175 | UInt16 NameSize; 176 | UInt16 ExtraSize; 177 | UInt16 CommentSize; 178 | UInt16 DiskNumberStart; 179 | UInt16 InternalAttributes; 180 | UInt32 ExternalAttributes; 181 | UInt32 LocalHeaderOffset; 182 | }; 183 | 184 | struct CBlockFull 185 | { 186 | UInt32 Signature; 187 | CBlock Header; 188 | }; 189 | */ 190 | 191 | namespace NFlags 192 | { 193 | const int kEncrypted = 1 << 0; 194 | const int kLzmaEOS = 1 << 1; 195 | const int kDescriptorUsedMask = 1 << 3; 196 | const int kStrongEncrypted = 1 << 6; 197 | const int kUtf8 = 1 << 11; 198 | 199 | const int kImplodeDictionarySizeMask = 1 << 1; 200 | const int kImplodeLiteralsOnMask = 1 << 2; 201 | 202 | const int kDeflateTypeBitStart = 1; 203 | const int kNumDeflateTypeBits = 2; 204 | const int kNumDeflateTypes = (1 << kNumDeflateTypeBits); 205 | const int kDeflateTypeMask = (1 << kNumDeflateTypeBits) - 1; 206 | } 207 | 208 | namespace NHostOS 209 | { 210 | enum EEnum 211 | { 212 | kFAT = 0, 213 | kAMIGA = 1, 214 | kVMS = 2, // VAX/VMS 215 | kUnix = 3, 216 | kVM_CMS = 4, 217 | kAtari = 5, // what if it's a minix filesystem? [cjh] 218 | kHPFS = 6, // filesystem used by OS/2 (and NT 3.x) 219 | kMac = 7, 220 | kZ_System = 8, 221 | kCPM = 9, 222 | kTOPS20 = 10, // pkzip 2.50 NTFS 223 | kNTFS = 11, // filesystem used by Windows NT 224 | kQDOS = 12, // SMS/QDOS 225 | kAcorn = 13, // Archimedes Acorn RISC OS 226 | kVFAT = 14, // filesystem used by Windows 95, NT 227 | kMVS = 15, 228 | kBeOS = 16, // hybrid POSIX/database filesystem 229 | kTandem = 17, 230 | kOS400 = 18, 231 | kOSX = 19 232 | }; 233 | } 234 | namespace NUnixAttribute 235 | { 236 | const UInt32 kIFMT = 0170000; /* Unix file type mask */ 237 | 238 | const UInt32 kIFDIR = 0040000; /* Unix directory */ 239 | const UInt32 kIFREG = 0100000; /* Unix regular file */ 240 | const UInt32 kIFSOCK = 0140000; /* Unix socket (BSD, not SysV or Amiga) */ 241 | const UInt32 kIFLNK = 0120000; /* Unix symbolic link (not SysV, Amiga) */ 242 | const UInt32 kIFBLK = 0060000; /* Unix block special (not Amiga) */ 243 | const UInt32 kIFCHR = 0020000; /* Unix character special (not Amiga) */ 244 | const UInt32 kIFIFO = 0010000; /* Unix fifo (BCC, not MSC or Amiga) */ 245 | 246 | const UInt32 kISUID = 04000; /* Unix set user id on execution */ 247 | const UInt32 kISGID = 02000; /* Unix set group id on execution */ 248 | const UInt32 kISVTX = 01000; /* Unix directory permissions control */ 249 | const UInt32 kENFMT = kISGID; /* Unix record locking enforcement flag */ 250 | const UInt32 kIRWXU = 00700; /* Unix read, write, execute: owner */ 251 | const UInt32 kIRUSR = 00400; /* Unix read permission: owner */ 252 | const UInt32 kIWUSR = 00200; /* Unix write permission: owner */ 253 | const UInt32 kIXUSR = 00100; /* Unix execute permission: owner */ 254 | const UInt32 kIRWXG = 00070; /* Unix read, write, execute: group */ 255 | const UInt32 kIRGRP = 00040; /* Unix read permission: group */ 256 | const UInt32 kIWGRP = 00020; /* Unix write permission: group */ 257 | const UInt32 kIXGRP = 00010; /* Unix execute permission: group */ 258 | const UInt32 kIRWXO = 00007; /* Unix read, write, execute: other */ 259 | const UInt32 kIROTH = 00004; /* Unix read permission: other */ 260 | const UInt32 kIWOTH = 00002; /* Unix write permission: other */ 261 | const UInt32 kIXOTH = 00001; /* Unix execute permission: other */ 262 | } 263 | 264 | namespace NAmigaAttribute 265 | { 266 | const UInt32 kIFMT = 06000; /* Amiga file type mask */ 267 | const UInt32 kIFDIR = 04000; /* Amiga directory */ 268 | const UInt32 kIFREG = 02000; /* Amiga regular file */ 269 | const UInt32 kIHIDDEN = 00200; /* to be supported in AmigaDOS 3.x */ 270 | const UInt32 kISCRIPT = 00100; /* executable script (text command file) */ 271 | const UInt32 kIPURE = 00040; /* allow loading into resident memory */ 272 | const UInt32 kIARCHIVE = 00020; /* not modified since bit was last set */ 273 | const UInt32 kIREAD = 00010; /* can be opened for reading */ 274 | const UInt32 kIWRITE = 00004; /* can be opened for writing */ 275 | const UInt32 kIEXECUTE = 00002; /* executable image, a loadable runfile */ 276 | const UInt32 kIDELETE = 00001; /* can be deleted */ 277 | } 278 | } 279 | 280 | }} 281 | 282 | #endif // ZIPHEADER_H 283 | -------------------------------------------------------------------------------- /src/qcounterthread.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | QCounterThread: counting thread. It's a part of QOP. 3 | Copyright (C) 2010 Wangbin 4 | (aka. nukin in ccmove & novesky in http://forum.motorolafans.com) 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | ******************************************************************************/ 20 | #include "qcounterthread.h" 21 | #include 22 | 23 | QCounterThread::QCounterThread(const QStringList &f) 24 | :files(f),ct(Size) 25 | { 26 | maximum.size=0; 27 | } 28 | 29 | QCounterThread::~QCounterThread() {} 30 | 31 | #if !CONFIG_QT4 && !defined(QT_THREAD_SUPPORT) 32 | void QCounterThread::start() { run();} 33 | #endif //QT_THREAD_SUPPORT 34 | void QCounterThread::setFiles(const QStringList &f) { files=f;} 35 | 36 | void QCounterThread::setCountType(CountType t) { ct=t;} 37 | 38 | void QCounterThread::run() 39 | { 40 | maximum.size=0; 41 | if(ct==Size) sizeOfFiles(files); 42 | else if(ct==Num) numOfFiles(files); 43 | else numOfFilesNoDir(files); 44 | emit done(); 45 | } 46 | 47 | uint QCounterThread::numOfFilesNoDir(const QStringList& list) 48 | { 49 | QString name; //static 50 | for(QStringList::ConstIterator it = list.begin();it != list.end(); ++it) { 51 | name=*it; 52 | if ((*it != QLatin1String(".")) && (*it != QLatin1String(".."))) { 53 | if(QFileInfo(name).isDir()) { 54 | QStringList pathList; 55 | QStringList nameList=QDir(name).entryList(QDir::Files|QDir::Dirs|QDir::NoSymLinks|QDir::Hidden|QDir::Readable); 56 | for(QStringList::ConstIterator it = nameList.begin();it != nameList.end(); ++it) 57 | if ((*it != QLatin1String(".")) && (*it != QLatin1String(".."))) pathList.append(name+"/"+*it); //can't be root,so override 58 | numOfFilesNoDir(pathList); 59 | } else ++maximum.num; 60 | } 61 | } emit maximumChanged(maximum.num); 62 | return maximum.num; 63 | } 64 | 65 | uint QCounterThread::numOfFiles(const QStringList& list) 66 | { 67 | QString name; 68 | for(QStringList::ConstIterator it = list.begin();it != list.end(); ++it) { 69 | name=*it; 70 | if ((*it != QLatin1String(".")) && (*it != QLatin1String(".."))) { 71 | if(QFileInfo(name).isDir()) { 72 | QStringList pathList; 73 | QStringList nameList=QDir(name).entryList(QDir::Files|QDir::Dirs|QDir::NoSymLinks|QDir::Hidden|QDir::Readable); 74 | for(QStringList::ConstIterator it = nameList.begin();it != nameList.end(); ++it) 75 | if ((*it != QLatin1String(".")) && (*it != QLatin1String(".."))) pathList.append(name+"/"+*it); //can't be root,so override 76 | numOfFiles(pathList); 77 | } ++maximum.num; 78 | } 79 | } emit maximumChanged(maximum.num); 80 | return maximum.num; 81 | } 82 | 83 | uint QCounterThread::sizeOfFiles(const QStringList& list) 84 | { 85 | QString name; 86 | for(QStringList::ConstIterator it = list.begin();it != list.end(); ++it) { 87 | name=*it; 88 | if ((*it != QLatin1String(".")) && (*it != QLatin1String(".."))) { 89 | if(QFileInfo(name).isDir()) { 90 | QStringList pathList; 91 | //filter is important. if list symlinks, the target size will be added 92 | QStringList nameList=QDir(name).entryList(QDir::Files|QDir::Dirs|QDir::NoSymLinks|QDir::Hidden|QDir::Readable); 93 | for(QStringList::ConstIterator it = nameList.begin();it != nameList.end(); ++it) 94 | if ((*it != QLatin1String(".")) && (*it != QLatin1String(".."))) pathList.append(name+"/"+*it); //can't be root,so override 95 | sizeOfFiles(pathList); 96 | } else { 97 | maximum.size+=QFileInfo(*it).size(); //QFileInfo()::isSymLink() 98 | //emit maximumChanged(size); //too frequent. app will abort in windows 99 | } 100 | } 101 | } emit maximumChanged(maximum.size); 102 | return maximum.size; 103 | } 104 | 105 | 106 | -------------------------------------------------------------------------------- /src/qcounterthread.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | QCounterThread: counting thread. It's a part of QOP. 3 | Copyright (C) 2010 Wangbin 4 | (aka. nukin in ccmove & novesky in http://forum.motorolafans.com) 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | ******************************************************************************/ 20 | /*! 21 | EZX's threading is awful 22 | */ 23 | #ifndef QCOUNTERTHREAD_H 24 | #define QCOUNTERTHREAD_H 25 | 26 | #include "qtcompat.h" 27 | #include 28 | #include 29 | 30 | 31 | /* 32 | if no thread support in qt2 and qt3, inherits qobject 33 | why the following is wrong in qt2(moc) 34 | #if !CONFIG_QT4 35 | public QObject 36 | #if defined(QT_THREAD_SUPPORT) 37 | , public QThread 38 | #endif //QT_THREAD_SUPPORT 39 | #else 40 | public QThread 41 | #endif //CONFIG_QT4 42 | */ 43 | 44 | class QCounterThread : 45 | #if !CONFIG_QT4 46 | public QObject 47 | #if defined(QT_THREAD_SUPPORT) 48 | , 49 | #endif //QT_THREAD_SUPPORT 50 | #endif //CONFIG_QT4 51 | #if CONFIG_QT4 || defined(QT_THREAD_SUPPORT) 52 | public QThread 53 | #endif 54 | { 55 | Q_OBJECT 56 | public: 57 | //Unknow: do not recount. 58 | enum CountType { 59 | Size=0x0, Num=0x1, NumNoDir=0x3 60 | }; 61 | 62 | QCounterThread(const QStringList& files=QStringList()); 63 | virtual ~QCounterThread(); 64 | 65 | void setFiles(const QStringList&); 66 | void setCountType(CountType); 67 | #if !CONFIG_QT4 && !defined(QT_THREAD_SUPPORT) 68 | void start(); 69 | #endif //QT_THREAD_SUPPORT 70 | virtual void run(); 71 | //int maximum(); 72 | 73 | signals: 74 | void done(); 75 | void maximumChanged(int); 76 | 77 | public: 78 | uint numOfFilesNoDir(const QStringList&); 79 | uint numOfFiles(const QStringList&); //or return uint 80 | uint sizeOfFiles(const QStringList&); 81 | 82 | private: 83 | QStringList files; 84 | union { 85 | uint size; 86 | uint num; 87 | } maximum; 88 | CountType ct; 89 | 90 | }; 91 | 92 | 93 | #endif // QCOUNTERTHREAD_H 94 | -------------------------------------------------------------------------------- /src/qop.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | QOP: Qt Output Parser for tar, zip etc with a compression/extraction progress indicator 3 | Copyright (C) 2011 Wangbin 4 | (aka. nukin in ccmove & novesky in http://forum.motorolafans.com) 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | ******************************************************************************/ 20 | 21 | #ifndef QOP_H 22 | #define QOP_H 23 | 24 | #include 25 | #include "QOutParser.h" 26 | #include "qarchive/arcreader.h" 27 | #include "qarchive/qarchive.h" 28 | #include "qarchive/tar/qtar.h" 29 | #ifndef EZPROGRESS 30 | #define EZPROGRESS 31 | #endif 32 | #ifdef EZPROGRESS 33 | #include "gui/ezprogressdialog.h" 34 | #endif 35 | 36 | class Qop :public QObject 37 | { 38 | Q_OBJECT 39 | public: 40 | Qop(); 41 | ~Qop(); 42 | 43 | void setUpdateAllMessage(bool all); 44 | void extract(const QString& archive,const QString& outDir); 45 | void execute(const QString& cmd); //execute(const QString& program,const QStringList& arg) 46 | //void parseOutput(); 47 | //void pipeView(); 48 | 49 | void setInternal(bool); 50 | void setInterval(unsigned int interval); 51 | void setArchive(const QString& archive_path); 52 | 53 | void setTimeFormat(const QString& format); 54 | //union!! 55 | /*! 56 | for build-in method 57 | */ 58 | Archive::QArchive* archive; 59 | 60 | /*! 61 | for tools in PATH with qop executable. In Qt2.x, copy QProcess 62 | */ 63 | QOutParser *parser; 64 | #ifndef QT_NO_PROCESS 65 | QProcess *process; 66 | #endif //QT_NO_PROCESS 67 | /*! 68 | common gui for all 69 | */ 70 | #ifndef EZPROGRESS 71 | UTIL_ProgressDialog *progress; 72 | #else 73 | EZProgressDialog *progress; 74 | #endif //EZPROGRESS 75 | int steps; 76 | const char* parser_type; 77 | 78 | void initArchive(); 79 | void initParser(); 80 | void initProcess(); 81 | 82 | private slots: 83 | void readStdOut(); 84 | void readStdErr(); 85 | 86 | private: 87 | void initGui(); 88 | 89 | bool all_msg; 90 | bool internal; 91 | unsigned int interval; 92 | QString arc_path; 93 | }; 94 | 95 | #endif // QOP_H 96 | -------------------------------------------------------------------------------- /src/utils/convert.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Name: description 3 | Copyright (C) 2011 Wang Bin 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | ******************************************************************************/ 19 | 20 | #include "convert.h" 21 | #include 22 | #include 23 | /*! 24 | a=h*b+r, b=2^(10*i)=2^n, r=a-h*b=a-(h<>n; 26 | */ 27 | //slower ? 28 | const double K2Ki = 1000.0/1024.0; 29 | const char* const unit[]={"b", "Kb", "Mb", "Gb"}; 30 | //static char ss[11]; //abcd.efg Mb 31 | //snprintf is not supported in MSVC, use _snprintf 32 | #define KiMask ((~0)^(0x400-1)) //0x400==1024, 0x400-1==111111111, KiMask==111...11000000000 33 | const unsigned int kMask[] = {0, (~0)^0x3ff, (~0)^((1<<20)-1), (~0)^((1<<30)-1)}; 34 | const unsigned int iMask[] = { 0, (1<<10)-1, (1<<20)-1, (1<<30)-1};//, (1UL<<40)-1}; //To large 35 | const unsigned int iShift[] = { 0, 10, 20, 30, 40}; 36 | /*! 37 | a = a0+a1*1024+a2*1024^2+...+an*1024^n 38 | q = an, r = a-an*1024^n 39 | rr = (a&iMask[n])/(1024^n)*1000 == (a&iMask[n])/(1024^(n-1))*(1000/1024) ==(a&iMask[n])>>iShift[n-1]*K2Ki; 40 | */ 41 | //#include 42 | #if !__GNUC__ 43 | #undef snprintf 44 | #define snprintf _snprintf 45 | #endif 46 | char* size2str(size_t a) 47 | { 48 | int i=0; 49 | #if 1 50 | //unsigned int q=a; 51 | //for(;q&KiMask;q>>=10,++i); //for(;q>=1024;q>>=10,++i); 52 | while (a&kMask[++i]) ; --i; 53 | #else 54 | while (a>>iShift[++i]); --i;//q>>=iShift[--i]; 55 | #endif 56 | unsigned int r = ((a&iMask[i])>>iShift[i-1])*K2Ki; //(unsigned int)((a&iMask[i])*K2Ki)>>iShift[i-1]; 57 | //char *ss = (char*)malloc(11); 58 | static char ss[11]; 59 | //memset(ss, 0, sizeof(ss)); 60 | snprintf(ss, 11, "%d.%03d%-2s", a>>iShift[i], r, unit[i]); 61 | return ss; 62 | } 63 | 64 | //ISO 8601 65 | char* msec2str(int pMsec) 66 | { 67 | int ms = pMsec%1000/100; //(pMsec%1000)/100 //hh:mm:ss.x 68 | pMsec/=1000; 69 | int sec = pMsec%60; 70 | int min =(pMsec/60)%60; 71 | int hour = pMsec/3600; 72 | static char time[11]; 73 | //memset(time, ' ', sizeof(time)); 74 | snprintf(time, sizeof(time), "%02d:%02d:%02d.%01d", hour, min, sec, ms); 75 | return time; 76 | } 77 | 78 | char* msec2secstr(int pMsec) 79 | { 80 | //int ms = pMsec%1000; //(pMsec%1000)/100 //sec.x 81 | //pMsec/=1000; 82 | static char time[10]; 83 | snprintf(time, sizeof(time), "%.1f", pMsec/1000.0); 84 | return time; 85 | } 86 | 87 | char* sec2str(int pSec) 88 | { 89 | int sec = pSec%60; 90 | int min = (pSec/60)%60; 91 | int hour = pSec/3600; 92 | static char time[9]; 93 | //memset(time, ' ', sizeof(time)); 94 | snprintf(time, sizeof(time), "%02d:%02d:%02d", hour, min, sec); 95 | return time; 96 | } 97 | 98 | 99 | time_format_converter g_time_convert = msec2str; 100 | 101 | -------------------------------------------------------------------------------- /src/utils/convert.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Name: description 3 | Copyright (C) 2011 Wang Bin 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | ******************************************************************************/ 19 | 20 | #ifndef CONVERT_H 21 | #define CONVERT_H 22 | 23 | #include 24 | 25 | //extern "C" { 26 | extern char* size2str(size_t size); 27 | 28 | extern char* msec2str(int msec); 29 | extern char* msec2secstr(int msec); 30 | extern char* sec2str(int sec); 31 | 32 | typedef char* (*size_format_converter)(int); 33 | typedef char* (*time_format_converter)(int); 34 | 35 | extern time_format_converter g_time_convert; 36 | 37 | //} 38 | 39 | //char* size2str(unsigned int a); 40 | //to speed up! 41 | #define KInv 1./1024 42 | //const float KInv=1./1024; 43 | template 44 | inline 45 | char* size2str(unsigned int s) 46 | { 47 | static const char *unit = "b"; 48 | T v=(T)s; 49 | if(v>(T)1024) { 50 | v*=KInv; //v/=1024; 51 | unit="Kb"; 52 | } 53 | if(v>(T)1024) { 54 | v*=KInv; 55 | unit="Mb"; 56 | } 57 | if(v>(T)1024) { 58 | v*=KInv; 59 | unit="G"; 60 | } 61 | static char ss[10]; 62 | //if(typeid(T)==typeid(double) || typeid(T)==typeid(float)) //typeof 63 | sprintf(ss, "%.2f%s", v, unit); 64 | //else 65 | //sprintf(ss, "%d%s", v, unit); 66 | return ss; 67 | } 68 | 69 | 70 | #endif // CONVERT_H 71 | -------------------------------------------------------------------------------- /src/utils/qt_util.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Name: description 3 | Copyright (C) 2011 Wang Bin 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | ******************************************************************************/ 19 | 20 | #include "qt_util.h" 21 | 22 | #define SLEEP_QTIME 0 23 | #define SLEEP_WAITCONDITION 1 24 | #define SLEEP_EVENTLOOP 0 25 | #if QT_VERSION <= 0x040000 26 | #define SLEEP_EVENTLOOP 0 27 | #endif 28 | 29 | 30 | 31 | #include "qtcompat.h" 32 | #if QT_VERSION >= 0x040700 33 | #include 34 | #else 35 | #include 36 | typedef QTime QElapsedTimer; 37 | #endif 38 | 39 | #if SLEEP_QTIME 40 | #include 41 | #elif SLEEP_EVENTLOOP 42 | #include 43 | #include 44 | #elif SLEEP_WAITCONDITION 45 | #if CONFIG_QT2 46 | #include 47 | #else 48 | #include 49 | #include 50 | #endif //CONFIG_QT2 51 | static QMutex mutex; 52 | #else 53 | #ifdef Q_OS_WIN 54 | #include //compile error in mingw 55 | #endif //Q_OS_WIN 56 | #endif //SLEEP_QTIME 57 | 58 | 59 | 60 | 61 | namespace QT_UTIL { 62 | 63 | //sleep和usleep都已经obsolete,建议使用nanosleep代替 64 | void qSleep(int ms) 65 | { 66 | #if SLEEP_QTIME 67 | QTime dieTime = QTime::currentTime().addMSecs(ms); 68 | while( QTime::currentTime() < dieTime ) 69 | QCoreApplication::processEvents(QEventLoop::AllEvents, 100); 70 | #elif SLEEP_EVENTLOOP 71 | QEventLoop eventloop; 72 | QTimer::singleShot(ms, &eventloop, SLOT(quit())); 73 | eventloop.exec(); 74 | #elif SLEEP_WAITCONDITION 75 | mutex.lock(); 76 | static QWaitCondition wait; 77 | wait.wait(&mutex,ms); 78 | mutex.unlock(); 79 | #else 80 | #ifdef Q_OS_WIN 81 | Sleep(uint(ms)); 82 | #else 83 | struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 }; 84 | nanosleep(&ts, NULL); 85 | #endif //Q_OS_WIN 86 | #endif //SLEEP_QTIME 87 | 88 | } 89 | 90 | //inline static 91 | void qWait(int ms) 92 | { 93 | QElapsedTimer timer; 94 | timer.start(); 95 | do { 96 | #if CONFIG_QT4 97 | //解决界面无法刷新的问题 98 | QCoreApplication::processEvents(QEventLoop::AllEvents, ms); 99 | #else 100 | qApp->processEvents(ms); 101 | #endif 102 | qSleep(10); //解决程序CPU占用率过高的问题 103 | } while (timer.elapsed() < ms); 104 | } 105 | 106 | } //nameespace QT_UTIL 107 | -------------------------------------------------------------------------------- /src/utils/qt_util.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Name: description 3 | Copyright (C) 2011 Wang Bin 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | ******************************************************************************/ 19 | 20 | #ifndef QT_UTIL_H 21 | #define QT_UTIL_H 22 | 23 | 24 | namespace QT_UTIL { 25 | //sleep和usleep都已经obsolete,建议使用nanosleep代替 26 | void qSleep(int ms); 27 | void qWait(int ms); 28 | } //nameespace QT_UTIL 29 | 30 | #endif // QT_UTIL_H 31 | -------------------------------------------------------------------------------- /src/utils/strutil.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Name: description 3 | Copyright (C) 2011 Wang Bin 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | ******************************************************************************/ 19 | 20 | #include "strutil.h" 21 | 22 | 23 | //template reverse(T* str) 24 | //template reverse(const T* str) { T* t=new T[], copy, reverse(t)> 25 | //reverse(T*,int begin,int end) 26 | const char* reverse_string(const char *str) 27 | { 28 | char* tmp = new char[strlen(str) + 1]; //remove it 29 | memcpy(tmp,str,strlen(str)); 30 | strcpy(tmp,str); 31 | char* ret = tmp; 32 | char* p = tmp + strlen(str) - 1; 33 | while (p > tmp) { 34 | *p ^= *tmp; 35 | *tmp ^= *p; 36 | *p ^= *tmp; 37 | /*! 38 | *p = *p + *tmp; 39 | *tmp = *p - *tmp; 40 | *p = *p - *tmp; 41 | */ 42 | --p; ++tmp; 43 | } 44 | return ret; 45 | 46 | /* 47 | char *ptr = str; 48 | while(*ptr!= '\0') ptr++; 49 | ptr--; 50 | //while(str < ptr){ 51 | // temp = *str; 52 | // *str++ = *ptr; 53 | // *ptr-- = temp; 54 | //} 55 | char temp; 56 | for(; str < ptr; ptr--,str++){ 57 | temp = *str; 58 | *str = *ptr; //shit happens; *str++ = *ptr; 59 | *ptr = temp; // *ptr-- = temp; 60 | } 61 | return ptr; 62 | */ 63 | } 64 | 65 | -------------------------------------------------------------------------------- /src/utils/strutil.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Name: description 3 | Copyright (C) 2011 Wang Bin 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License along 16 | with this program; if not, write to the Free Software Foundation, Inc., 17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | ******************************************************************************/ 19 | 20 | #ifndef STRUTIL_H 21 | #define STRUTIL_H 22 | 23 | #include 24 | #include 25 | 26 | extern const char* reverse_string(const char *string); 27 | 28 | 29 | inline bool str_starts_with(const std::string& str, const std::string& substr) 30 | { 31 | size_t pos = str.find(substr); 32 | if (pos==std::string::npos || pos!=0) 33 | return false; 34 | return true; 35 | } 36 | 37 | inline bool str_ends_with(const std::string& str, const std::string& substr) 38 | { 39 | size_t pos = str.find(substr); 40 | if (pos==std::string::npos) 41 | return false; 42 | return str.compare(pos, str.size()-pos, substr)==0; 43 | } 44 | 45 | inline bool cstr_starts_with(const char* str, const char* substr) 46 | { 47 | const char * pos = strstr(str, substr); 48 | if (pos==NULL || pos!=str) 49 | return false; 50 | return true; 51 | } 52 | 53 | inline bool cstr_ends_with(const char* str, const char* substr) 54 | { 55 | const char * pos = strstr(str, substr); 56 | if (pos==NULL) 57 | return false; 58 | return strcmp(pos, substr)==0; 59 | } 60 | 61 | 62 | #endif // STRUTIL_H 63 | -------------------------------------------------------------------------------- /src/utils/util.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Utils 3 | Copyright (C) 2010 Wangbin 4 | (aka. nukin in ccmove & novesky in http://forum.motorolafans.com) 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | ******************************************************************************/ 20 | 21 | #include "util.h" 22 | #include 23 | #include 24 | 25 | //Endian 26 | /*! 27 | int isBigEndian() 28 | { 29 | union { 30 | unsigned short a; 31 | char b; 32 | } t; 33 | t.a=1; 34 | return t.b!=1; 35 | } 36 | 37 | int isLittleEndian() 38 | { 39 | //int i = 0; 40 | //((char *)(&i))[0] = 1; 41 | //return (i == 1); 42 | 43 | int x=1; 44 | return (*(char*)&x==1); 45 | } 46 | */ 47 | void swap_endian(char* buf,int bytes) 48 | { 49 | int c = bytes>>1; 50 | for(int i = 0; i < c; i++) { 51 | char t =buf[i]; 52 | buf[i]=buf[c-1-i]; 53 | buf[c-1-i]=t; 54 | } 55 | } 56 | 57 | 58 | 59 | bool checkHexData(unsigned int magic,unsigned char* data,size_t offset) 60 | { 61 | bool eq=true; 62 | unsigned int mask=0xff; 63 | size_t len=0; 64 | unsigned int magic_t=magic; 65 | while(magic_t>>=8) { 66 | len+=8; 67 | } 68 | printf("magic:0x%x length:%d\n",magic, len); 69 | data+=offset; 70 | while(len) { 71 | mask=0xff<>len ) eq=false; 73 | len-=8; 74 | } 75 | return eq; 76 | } 77 | 78 | 79 | //dir and filename 80 | //todo use windows api 81 | #if defined(Q_OS_WIN32) || defined(Q_OS_MSDOS) 82 | #define DELIMITER '\\' 83 | #else 84 | #define DELIMITER '/' 85 | #endif 86 | const char* getFileName(const char* path) 87 | { 88 | char *fileName=new char[strlen(path)+1];//(char*)malloc((strlen(path)+1)*sizeof(char)); 89 | strcpy(fileName,path); 90 | if(strchr(path,DELIMITER)!=0) { 91 | while ((*fileName++!='\0')) ; 92 | while ((*fileName--!=DELIMITER)) ; 93 | fileName+=2; 94 | } 95 | return fileName; 96 | } 97 | 98 | const char* getFileDir(const char* path) 99 | { 100 | if(!strchr(path,DELIMITER)) return "."; 101 | char* dir=new char[strlen(path)+1];//(char*)malloc((strlen(path)+1)*sizeof(char)); 102 | strcpy(dir,path); 103 | char* q=dir; 104 | while ((*q++!='\0')) ; 105 | q--; 106 | while ((*q--!=DELIMITER)) ; 107 | q++; 108 | *q = '\0', q=dir; 109 | return q; 110 | } 111 | 112 | 113 | //#if defined(WIN32) 114 | //#include 115 | //#include 116 | //#endif 117 | /* 118 | char* get_exe_path() 119 | { 120 | static char buff[256]; 121 | char *p; 122 | #if defined(WIN32) 123 | //::GetModuleFileName(NULL, buff, sizeof(buff)); 124 | //p = strrchr(buff, '\\'); 125 | #else 126 | sprintf(buff, "/proc/%d/exe", getpid()); 127 | readlink(buff, buff, sizeof(buff)); 128 | p = strrchr(buff, '/'); 129 | #endif 130 | *p = 0; 131 | return buff; 132 | } 133 | */ 134 | 135 | /* Parse an octal number, ignoring leading and trailing nonsense. */ 136 | int parseOct(const char *p, size_t n) 137 | { 138 | int i = 0; 139 | while (*p < '0' || *p > '7') { 140 | ++p; --n; 141 | } 142 | while (*p >= '0' && *p <= '7' && n > 0) { 143 | i <<=3;//i *= 8; // 144 | i += *p - '0'; 145 | ++p; --n; 146 | } 147 | return (i); 148 | } 149 | 150 | 151 | -------------------------------------------------------------------------------- /src/utils/util.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Utils 3 | Copyright (C) 2010 Wangbin 4 | (aka. nukin in ccmove & novesky in http://forum.motorolafans.com) 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | ******************************************************************************/ 20 | #ifndef UTIL_H 21 | #define UTIL_H 22 | 23 | #define ROUND512(x) (((x)+0x1ff) & (~0x1ff)) // ((((x)+511)>>9)<<9) 24 | #define ROUND2P(x,p) ((((x)+(2<<(p))-1)>>p)< 28 | 29 | //template T reverse(T src,int len) 30 | template T* reverse(T* src,int len) 31 | { 32 | T* tmp = src; 33 | T* ret = tmp; 34 | T* p = tmp + len - 1; 35 | while (p > tmp) { 36 | *p ^= *tmp ^= *p ^= *tmp; 37 | // *p += *tmp; *tmp = *p - *tmp; *p -= *tmp; 38 | --p; ++tmp; 39 | } 40 | return ret; 41 | } 42 | 43 | 44 | //extern int isBigEndian(); 45 | //extern int isLittleEndian(); 46 | extern void swap_endian(char* buf,int type_bytes); 47 | extern bool checkHexData(unsigned int magic,unsigned char* data,size_t offset=0); 48 | 49 | 50 | extern const char* getFileName(const char* path); 51 | extern const char* getFileDir(const char* path); 52 | 53 | extern int parseOct(const char *p, size_t n); 54 | 55 | inline unsigned int readUInt(const unsigned char *data) 56 | { 57 | return (data[0]) + (data[1]<<8) + (data[2]<<16) + (data[3]<<24); 58 | } 59 | 60 | inline unsigned short readUShort(const unsigned char *data) 61 | { 62 | return (data[0]) + (data[1]<<8); 63 | } 64 | 65 | inline void writeUInt(unsigned char *data, unsigned int i) 66 | { 67 | data[0] = i & 0xff; 68 | data[1] = (i>>8) & 0xff; 69 | data[2] = (i>>16) & 0xff; 70 | data[3] = (i>>24) & 0xff; 71 | } 72 | 73 | inline void writeUShort(unsigned char *data, unsigned short i) 74 | { 75 | data[0] = i & 0xff; 76 | data[1] = (i>>8) & 0xff; 77 | } 78 | 79 | //expression template 80 | inline void copyUInt(unsigned char *dest, const unsigned char *src) 81 | { 82 | dest[0] = src[0]; 83 | dest[1] = src[1]; 84 | dest[2] = src[2]; 85 | dest[3] = src[3]; 86 | } 87 | 88 | inline void copyUShort(unsigned char *dest, const unsigned char *src) 89 | { 90 | dest[0] = src[0]; 91 | dest[1] = src[1]; 92 | } 93 | 94 | #endif // UTIL_H 95 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | version.h: version information 3 | Copyright (C) 2010 Wangbin 4 | (aka. nukin in ccmove & novesky in http://forum.motorolafans.com) 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License along 17 | with this program; if not, write to the Free Software Foundation, Inc., 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | ******************************************************************************/ 20 | 21 | #ifndef VERSION_H 22 | #define VERSION_H 23 | 24 | template 25 | char* version_str() 26 | { 27 | char *ver_str = new char[9]; 28 | sprintf(ver_str, "%d.%d.%d", major, minor, patch); 29 | return ver_str; 30 | } 31 | 32 | template 33 | struct version { 34 | enum{ 35 | value = ver, 36 | major = ((ver&0xff0000)>>16), 37 | minor = ((ver&0xff00)>>8), 38 | patch = (ver&0xff) 39 | }; 40 | //static char* string; 41 | }; 42 | 43 | #define APP_NAME "qop" 44 | 45 | #undef APP_VERSION //0x000300 46 | 47 | #define MAJOR 0 //((APP_VERSION&0xff0000)>>16) 48 | #define MINOR 3 //((APP_VERSION&0xff00)>>8) 49 | #define PATCH 5 //(APP_VERSION&0xff) 50 | 51 | #define VERSION_CHK(major, minor, patch) \ 52 | (((major&0xff)<<16) | ((minor&0xff)<<8) | (patch&0xff)) 53 | 54 | #define APP_VERSION VERSION_CHK(MAJOR, MINOR, PATCH) 55 | 56 | //#define APP_VERSION_STR version_str() 57 | //#define APP_VERSION_STR version::string 58 | 59 | 60 | /*! Stringify \a x. */ 61 | #define _TOSTR(x) #x 62 | /*! Stringify \a x, perform macro expansion. */ 63 | #define TOSTR(x) _TOSTR(x) 64 | 65 | const char* const version_string = TOSTR(MAJOR)"."TOSTR(MINOR)"."TOSTR(PATCH)"(" \ 66 | __DATE__", "__TIME__")"; 67 | 68 | #define APP_VERSION_STR version_string 69 | 70 | #endif // VERSION_H 71 | 72 | 73 | -------------------------------------------------------------------------------- /test/.findqop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat < 5 | 2011-04-20 6 | 7 | EOF 8 | 9 | error() 10 | { 11 | echo -e "\e[1;31merror:\e[m $1" 12 | exit 1 13 | } 14 | 15 | 16 | export PATH=../bin:$PATH 17 | 18 | if [ -n "`uname -a |grep -E 'MINGW|CYGWIN'`" ];then 19 | qop="qop.exe" 20 | type -p $qop 2>/dev/null 21 | [ $? -ne 0 ] && qop="qop_win32.exe"; 22 | elif [ -n "`uname -a |grep 'Linux'`" ];then 23 | qop="qop" 24 | type -p $qop 2>/dev/null 25 | [ $? -ne 0 ] && qop="qop_linux" 26 | type -p $qop 2>/dev/null 27 | [ $? -ne 0 ] && qop="qop_linux_llvm" 28 | fi 29 | 30 | echo "$qop" 31 | type -p $qop 2>/dev/null 32 | [ $? -ne 0 ] && error "qop not found. Please set the PATH" 33 | 34 | :</dev/null 36 | [ $? -ne 0 ] && qop="qop.exe"; type -p $qop 2>/dev/null 37 | [ $? -ne 0 ] && qop="qop-maemo5"; type -p $qop 2>/dev/null 38 | [ $? -ne 0 ] && qop="qop-ezx"; type -p $qop 2>/dev/null 39 | [ $? -ne 0 ] && echo 'qop not found. Please set the PATH' && exit 40 | COMMENT 41 | -------------------------------------------------------------------------------- /test/7z-qop.sh: -------------------------------------------------------------------------------- 1 | . .findqop.sh 2 | 3 | if [ $# -gt 0 ]; then 4 | _7zfile=$@ 5 | else 6 | echo "input a 7zip file you want to extract" 7 | read _7zfile 8 | fi 9 | 10 | [ ! -f $_7zfile ] && echo "$_7zfile is not a file" && exit 11 | 12 | echo "7z x -y $_7zfile |$qop -n -t7z -T $((`7z l $_7zfile |sed -n '$s/\(.*\), \(.*\)folders/\2/p'`+`7z l $_7zfile |sed -n '$s/\(.*\) \(.*\)files.*/\2/p'`))" 13 | 14 | 7z x -y -o/tmp $_7zfile |$qop -n -t7z -T $((`7z l $_7zfile |sed -n '$s/\(.*\), \(.*\)folders/\2/p'`+`7z l $_7zfile |sed -n '$s/\(.*\) \(.*\)files.*/\2/p'`)) 15 | -------------------------------------------------------------------------------- /test/qop-tar.sh: -------------------------------------------------------------------------------- 1 | . .findqop.sh 2 | 3 | if [ $# -gt 0 ]; then 4 | compress=$@ 5 | else 6 | echo "input a directory you want to compress" 7 | read compress 8 | fi 9 | 10 | [ ! -d $compress ] && echo "$compress does not exist" && exit 11 | 12 | 13 | echo "$qop -C tar zcvvf /tmp/test.tgz $compress 2>/dev/null" 14 | echo "Compressing...Showing progress for size..." 15 | $qop -C tar zcvvf /tmp/test.tgz $compress 2>/dev/null 16 | 17 | echo "$qop -C tar zcvf /tmp/test.tgz $compress 2>/dev/null" 18 | echo "Compressing...Showing progress for number of files..." 19 | $qop -C tar zcvf /tmp/test.tgz $compress 2>/dev/null 20 | 21 | echo "$qop -C tar zxvvf /tmp/test.tgz -C /tmp 2>/dev/null 22 | Extracting...Showing progress for size..." 23 | $qop -C tar zxvvf /tmp/test.tgz -C /tmp 2>/dev/null 24 | -------------------------------------------------------------------------------- /test/qop-unrar.sh: -------------------------------------------------------------------------------- 1 | . .findqop.sh 2 | 3 | if [ $# -gt 0 ]; then 4 | rarfile=$@ 5 | else 6 | echo "input a rar file you want to extract" 7 | read rarfile 8 | fi 9 | 10 | [ ! -f $rarfile ] && echo "$rarfile is not a file" && exit 11 | 12 | ehco "$qop -C unrar x -o+ $rarfile /tmp 2>/dev/null" 13 | $qop -C unrar x -o+ $rarfile /tmp 2>/dev/null 14 | -------------------------------------------------------------------------------- /test/qop-unzip.sh: -------------------------------------------------------------------------------- 1 | . .findqop.sh 2 | 3 | if [ $# -gt 0 ]; then 4 | zipfile=$@ 5 | else 6 | echo "input a zip file you want to extract" 7 | read zipfile 8 | fi 9 | 10 | [ ! -f $zipfile ] && echo "$zipfile is not a file" && exit 11 | 12 | echo "$qop -C unzip -o $1 -d /tmp 2>/dev/null" 13 | $qop -C unzip -o $zipfile -d /tmp 2>/dev/null 14 | -------------------------------------------------------------------------------- /test/qop-zip.sh: -------------------------------------------------------------------------------- 1 | . .findqop.sh 2 | 3 | if [ $# -gt 0 ]; then 4 | compress=$@ 5 | else 6 | echo "input a directory you want to compress" 7 | read compress 8 | fi 9 | 10 | [ ! -d $compress ] && echo "$compress does not exist" && exit 11 | 12 | echo "$qop -C zip -ryv -9 /tmp/test.zip $compress 2>/dev/null 13 | Showing progress for size..." 14 | $qop -C zip -ryv -9 /tmp/test.zip $compress 2>/dev/null 15 | 16 | echo "$qop -C zip -ry -9 /tmp/test.zip $compress 2>/dev/null 17 | Showing progress for number of files..." 18 | $qop -C zip -ry -9 /tmp/test.zip $compress 2>/dev/null 19 | -------------------------------------------------------------------------------- /test/tar-qop.sh: -------------------------------------------------------------------------------- 1 | . .findqop.sh 2 | 3 | if [ $# -gt 0 ]; then 4 | compress=$@ 5 | else 6 | echo "input a directory you want to compress" 7 | read compress 8 | fi 9 | 10 | [ ! -d $compress ] && echo "$compress does not exist" && exit 11 | 12 | 13 | echo "tar zcvvf /tmp/test.tgz $compress |$qop $compress -m 2>/dev/null 14 | Compressing...Showing progress for size..." 15 | tar zcvvf /tmp/test.tgz $compress |$qop $compress -m 2>/dev/null 16 | 17 | echo "tar zcvf /tmp/test.tgz $compress |qop $compress -n 2>/dev/null 18 | Compressing...Showing progress for number of files..." 19 | tar zcvf /tmp/test.tgz $compress |$qop $compress -n 2>/dev/null 20 | 21 | echo "tar zxvvf /tmp/test.tgz -C /tmp |$qop -x /tmp/test.tgz 2>/dev/null 22 | Extracting...Showing progress for size..." 23 | tar zxvvf /tmp/test.tgz -C /tmp |$qop -x /tmp/test.tgz 2>/dev/null 24 | 25 | echo "tar zxvf /tmp/test.tgz -C /tmp |$qop -x /tmp/test.tgz 2>/dev/null 26 | Extracting...Showing progress for number of files..." 27 | 28 | echo `tar -zt /dev/null 30 | -------------------------------------------------------------------------------- /test/unrar-zip.sh: -------------------------------------------------------------------------------- 1 | . .findqop.sh 2 | 3 | if [ $# -gt 0 ]; then 4 | rarfile=$@ 5 | else 6 | echo "input a rar file you want to extract" 7 | read rarfile 8 | fi 9 | 10 | [ ! -f $rarfile ] && echo "$rarfile is not a file" && exit 11 | 12 | ehco "unrar x -o+ $rarfile /tmp |$qop -x $rarfile 2>/dev/null" 13 | unrar x -o+ $rarfile /tmp |$qop -x $rarfile 2>/dev/null 14 | 15 | -------------------------------------------------------------------------------- /test/unzip-qop.sh: -------------------------------------------------------------------------------- 1 | . .findqop.sh 2 | 3 | if [ $# -gt 0 ]; then 4 | zipfile=$@ 5 | else 6 | echo "input a zip file you want to extract" 7 | read zipfile 8 | fi 9 | 10 | [ ! -f $zipfile ] && echo "$zipfile is not a file" && exit 11 | 12 | echo "unzip -o $zipfile -d /tmp |$qop -x $zipfile 2>/dev/null" 13 | unzip -o $zipfile -d /tmp |$qop -x $zipfile 2>/dev/null 14 | -------------------------------------------------------------------------------- /test/zip-qop.sh: -------------------------------------------------------------------------------- 1 | . .findqop.sh 2 | 3 | if [ $# -gt 0 ]; then 4 | compress=$@ 5 | else 6 | echo "input a directory you want to compress" 7 | read compress 8 | fi 9 | 10 | [ ! -d $compress ] && echo "$compress does not exist" && exit 11 | 12 | #some version of zip(3.0) do not have -y 13 | rm -f /tmp/test.zip 14 | echo "zip -rv -9 /tmp/test.zip $compress |$qop $compress -m 2>/dev/null 15 | Compressing...Showing progress for size..." 16 | zip -rv -9 /tmp/test.zip $compress |$qop $compress -m 2>/dev/null 17 | 18 | rm -f /tmp/test.zip 19 | echo "zip -r -9 /tmp/test.zip $compress |$qop $compress -m 2>/dev/null 20 | Compressing...Showing progress for number of files..." 21 | zip -rv -9 /tmp/test.zip $compress |$qop $compress -m 2>/dev/null 22 | --------------------------------------------------------------------------------