summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/wpseditor/buildall.bat9
-rwxr-xr-xutils/wpseditor/buildall.sh4
-rw-r--r--utils/wpseditor/gui/src/qwpsdrawer.cpp27
-rw-r--r--utils/wpseditor/gui/src/qwpsdrawer.h8
-rw-r--r--utils/wpseditor/libwps/Makefile113
-rw-r--r--utils/wpseditor/libwps/buildall.bat4
-rwxr-xr-xutils/wpseditor/libwps/buildall.sh9
-rw-r--r--utils/wpseditor/libwps/cleanall.sh7
-rw-r--r--utils/wpseditor/libwps/src/proxy.c4
-rw-r--r--utils/wpseditor/libwps/targets.txt9
-rw-r--r--utils/wpseditor/screenshot/Makefile28
-rw-r--r--utils/wpseditor/wpseditor.pro4
12 files changed, 88 insertions, 138 deletions
diff --git a/utils/wpseditor/buildall.bat b/utils/wpseditor/buildall.bat
deleted file mode 100644
index b813a38510..0000000000
--- a/utils/wpseditor/buildall.bat
+++ /dev/null
@@ -1,9 +0,0 @@
1@echo off
2echo qmake...
3qmake
4echo Building gui...
5mingw32-make 1>nul
6echo Building libs...
7cd libwps
8call buildall.bat 2>nul
9cd ..
diff --git a/utils/wpseditor/buildall.sh b/utils/wpseditor/buildall.sh
deleted file mode 100755
index c891900813..0000000000
--- a/utils/wpseditor/buildall.sh
+++ /dev/null
@@ -1,4 +0,0 @@
1#!/bin/sh
2qmake && make
3cd libwps
4./buildall.sh 2> /dev/null
diff --git a/utils/wpseditor/gui/src/qwpsdrawer.cpp b/utils/wpseditor/gui/src/qwpsdrawer.cpp
index a506d5c03b..096d835491 100644
--- a/utils/wpseditor/gui/src/qwpsdrawer.cpp
+++ b/utils/wpseditor/gui/src/qwpsdrawer.cpp
@@ -17,14 +17,14 @@ QImage QWpsDrawer::backdrop;
17proxy_api QWpsDrawer::api; 17proxy_api QWpsDrawer::api;
18 18
19QWpsDrawer::QWpsDrawer( QWpsState *ws,QTrackState *ms, QWidget *parent ) 19QWpsDrawer::QWpsDrawer( QWpsState *ws,QTrackState *ms, QWidget *parent )
20 : QWidget(parent),wpsState(ws),trackState(ms),showGrid(false),mCurTarget("h10_5gb") { 20 : QWidget(parent),wpsState(ws),trackState(ms),showGrid(false),mCurTarget(qApp->applicationDirPath()+"/libwps_IRIVER_H10_5GB") {
21 21
22 tryResolve(); 22 tryResolve();
23 newTempWps(); 23 newTempWps();
24} 24}
25 25
26bool QWpsDrawer::tryResolve() { 26bool QWpsDrawer::tryResolve() {
27 QLibrary lib(qApp->applicationDirPath()+"/libwps_"+mCurTarget); 27 QLibrary lib(mCurTarget);
28 lib_wps_init = (pfwps_init)lib.resolve("wps_init"); 28 lib_wps_init = (pfwps_init)lib.resolve("wps_init");
29 lib_wps_display = (pfwps_display)lib.resolve("wps_display"); 29 lib_wps_display = (pfwps_display)lib.resolve("wps_display");
30 lib_wps_refresh = (pfwps_refresh)lib.resolve("wps_refresh"); 30 lib_wps_refresh = (pfwps_refresh)lib.resolve("wps_refresh");
@@ -47,7 +47,7 @@ bool QWpsDrawer::tryResolve() {
47 api.load_wps_backdrop = &QWpsDrawer::load_wps_backdrop; 47 api.load_wps_backdrop = &QWpsDrawer::load_wps_backdrop;
48 api.read_bmp_file = &QWpsDrawer::read_bmp_file; 48 api.read_bmp_file = &QWpsDrawer::read_bmp_file;
49 api.debugf = &qlogger; 49 api.debugf = &qlogger;
50 qDebug()<<(qApp->applicationDirPath()+"/libwps_"+mCurTarget+" resolved"); 50 qDebug()<<(mCurTarget+" resolved");
51 } 51 }
52 return mResolved; 52 return mResolved;
53} 53}
@@ -222,7 +222,7 @@ QString QWpsDrawer::getModelName(QString libraryName) {
222QList<QString> QWpsDrawer::getTargets() { 222QList<QString> QWpsDrawer::getTargets() {
223 QList<QString> list ; 223 QList<QString> list ;
224 QDir d = QDir(qApp->applicationDirPath()); 224 QDir d = QDir(qApp->applicationDirPath());
225 QFileInfoList libs = d.entryInfoList(QStringList("libwps*")); 225 QFileInfoList libs = d.entryInfoList(QStringList("libwps_*"));
226 qDebug() << libs.size()<<"libs found"; 226 qDebug() << libs.size()<<"libs found";
227 for (int i = 0; i < libs.size(); i++) { 227 for (int i = 0; i < libs.size(); i++) {
228 QString modelName = getModelName(libs[i].absoluteFilePath()); 228 QString modelName = getModelName(libs[i].absoluteFilePath());
@@ -230,15 +230,24 @@ QList<QString> QWpsDrawer::getTargets() {
230 if (modelName == "unknown") 230 if (modelName == "unknown")
231 continue; 231 continue;
232 list.append(modelName); 232 list.append(modelName);
233 libs_array[i].target_name = modelName;
234 libs_array[i].lib = libs[i].absoluteFilePath();
233 } 235 }
234 return list; 236 return list;
235} 237}
236bool QWpsDrawer::setTarget(QString target) { 238bool QWpsDrawer::setTarget(QString target) {
237 QLibrary lib(qApp->applicationDirPath()+"/libwps_"+mCurTarget); 239 foreach(lib_t cur_lib, libs_array)
238 //lib.unload(); 240 {
239 if (getModelName("libwps_"+target)!="unknown") { 241 if(cur_lib.target_name == target)
240 mCurTarget = target; 242 {
241 return tryResolve(); 243 QLibrary lib(cur_lib.lib);
244 //lib.unload();
245 if (getModelName(cur_lib.lib) != "unknown")
246 {
247 mCurTarget = cur_lib.lib;
248 return tryResolve();
249 }
250 }
242 } 251 }
243 return false; 252 return false;
244} 253}
diff --git a/utils/wpseditor/gui/src/qwpsdrawer.h b/utils/wpseditor/gui/src/qwpsdrawer.h
index 65e98723f5..eec4300286 100644
--- a/utils/wpseditor/gui/src/qwpsdrawer.h
+++ b/utils/wpseditor/gui/src/qwpsdrawer.h
@@ -5,6 +5,7 @@
5#include <QPixmap> 5#include <QPixmap>
6#include <QPointer> 6#include <QPointer>
7#include <QTemporaryFile> 7#include <QTemporaryFile>
8#include <QMap>
8 9
9#include "wpsstate.h" 10#include "wpsstate.h"
10 11
@@ -37,6 +38,13 @@ class QWpsDrawer : public QWidget {
37 QString mWpsString; 38 QString mWpsString;
38 QString mCurTarget; 39 QString mCurTarget;
39 static QString mTmpWpsString; 40 static QString mTmpWpsString;
41
42 struct lib_t
43 {
44 QString target_name;
45 QString lib;
46 };
47 QMap<int, lib_t> libs_array;
40 48
41 49
42protected: 50protected:
diff --git a/utils/wpseditor/libwps/Makefile b/utils/wpseditor/libwps/Makefile
index c5d0a39de1..879cc8e4db 100644
--- a/utils/wpseditor/libwps/Makefile
+++ b/utils/wpseditor/libwps/Makefile
@@ -8,15 +8,13 @@
8# 8#
9ROOT=../../.. 9ROOT=../../..
10 10
11OS = w32 11ifneq ($or($(findstring MINGW,$(shell uname)),$(findstring Windows_NT,$(OS))),)
12CC = gcc
13MKDIR = mkdir -p
14
15ifeq ($(findstring MINGW,$(shell uname)),MINGW)
16 OS = w32 12 OS = w32
17 CC = mingw32-gcc 13 CC = mingw32-gcc
18 COPY = copy 14 COPY = copy
19 RM = rm 15 RM = del
16 EXT = .dll
17 LDFLAGS = -DBUILD_DLL
20endif 18endif
21 19
22ifeq ($(findstring Linux,$(shell uname)),Linux) 20ifeq ($(findstring Linux,$(shell uname)),Linux)
@@ -24,39 +22,48 @@ ifeq ($(findstring Linux,$(shell uname)),Linux)
24 CC = gcc 22 CC = gcc
25 COPY = cp 23 COPY = cp
26 RM = rm -f 24 RM = rm -f
25 EXT = .so
26 LDFLAGS = -fPIC
27endif 27endif
28 28
29 29TARGETS=IRIVER_H10 \
30 IRIVER_H10_5GB \
31 IPOD_COLOR \
32 IPOD_NANO \
33 IPOD_VIDEO \
34 GIGABEAT_F \
35 GIGABEAT_S \
36 SANSA_E200 \
37 SANSA_C200
30 38
31SOURCES= \ 39SOURCES= \
32 src/api.c \ 40 src/api.c \
33 src/dummies.c \ 41 src/dummies.c \
34 src/lcd.c \ 42 src/lcd.c \
35 src/proxy.c \ 43 src/proxy.c \
36 $(ROOT)/apps/gui/scrollbar.c \ 44 $(ROOT)/apps/gui/scrollbar.c \
37 $(ROOT)/apps/gui/gwps-common.c \ 45 $(ROOT)/apps/gui/gwps-common.c \
38 $(ROOT)/apps/gui/wps_parser.c \ 46 $(ROOT)/apps/gui/wps_parser.c \
39 $(ROOT)/apps/gui/wps_debug.c \ 47 $(ROOT)/apps/gui/wps_debug.c \
40 $(ROOT)/apps/recorder/peakmeter.c \ 48 $(ROOT)/apps/recorder/peakmeter.c \
41 $(ROOT)/apps/recorder/icons.c \ 49 $(ROOT)/apps/recorder/icons.c \
42 $(ROOT)/apps/misc.c \ 50 $(ROOT)/apps/misc.c \
43 $(ROOT)/apps/status.c \ 51 $(ROOT)/apps/status.c \
44 $(ROOT)/firmware/common/ctype.c \ 52 $(ROOT)/firmware/common/ctype.c \
45 $(ROOT)/firmware/common/timefuncs.c \ 53 $(ROOT)/firmware/common/timefuncs.c \
46 $(ROOT)/firmware/common/unicode.c \ 54 $(ROOT)/firmware/common/unicode.c \
47 $(ROOT)/firmware/font.c \ 55 $(ROOT)/firmware/font.c \
48 $(ROOT)/firmware/font_cache.c \ 56 $(ROOT)/firmware/font_cache.c \
49 $(ROOT)/firmware/id3.c \ 57 $(ROOT)/firmware/id3.c \
50 $(ROOT)/firmware/lru.c \ 58 $(ROOT)/firmware/lru.c \
51 $(ROOT)/firmware/mp3data.c \ 59 $(ROOT)/firmware/mp3data.c \
52 $(ROOT)/firmware/replaygain.c 60 $(ROOT)/firmware/replaygain.c
53 61# $(ROOT)/apps/recorder/bmp.c
54# $(ROOT)/apps/recorder/bmp.c 62# $(ROOT)/apps/abrepeat.c \
55# $(ROOT)/apps/abrepeat.c \ 63# $(ROOT)/apps/action.c \
56# $(ROOT)/apps/action.c \ 64# $(ROOT)/apps/cuesheet.c \
57# $(ROOT)/apps/cuesheet.c \ 65# $(ROOT)/apps/gui/statusbar.c \
58# $(ROOT)/apps/gui/statusbar.c \ 66# $(ROOT)/apps/gui/gwps.c \
59# $(ROOT)/apps/gui/gwps.c \
60 67
61INCLUDE=-I src/include \ 68INCLUDE=-I src/include \
62 -I $(ROOT)/apps/gui \ 69 -I $(ROOT)/apps/gui \
@@ -68,34 +75,14 @@ INCLUDE=-I src/include \
68 75
69CFLAGS = -g -Wall -D__PCTOOL__ -DWPSEDITOR -DDEBUG -DROCKBOX_DIR_LEN=1 -DBUTTON_REMOTE 76CFLAGS = -g -Wall -D__PCTOOL__ -DWPSEDITOR -DDEBUG -DROCKBOX_DIR_LEN=1 -DBUTTON_REMOTE
70 77
71all: 78RESULTS := $(patsubst %,libwps_%$(EXT),$(TARGETS))
72 @echo To build, run the buildall.sh script
73
74build: build-$(OS)
75
76build-w32: $(SOURCES)
77 @echo CC [$(TARGET)]
78 @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -DBUILD_DLL $(SOURCES) -shared -o libwps_$(MODEL).dll
79
80build-linux: $(SOURCES)
81 @echo CC [$(TARGET)]
82 @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -shared -Wl,-soname,libwps_$(MODEL).so,-olibwps_$(MODEL).so -fPIC $(SOURCES)
83
84clean: clean-$(OS)
85
86clean-w32:
87 $(RM) "libwps_$(MODEL).dll"
88
89clean-linux:
90 $(RM) "libwps_$(MODEL).so"
91 79
92shared: shared-$(OS) 80all: $(RESULTS)
81 @$(COPY) $(RESULTS) ../gui/bin/
93 82
94shared-w32: $(SOURCES) 83libwps_%$(EXT): $(SOURCES)
95 @echo CC [IRIVER_H10_5GB] 84 @echo CC [$(subst libwps_,,$(subst $(EXT),,$@))]
96 @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -DBUILD_DLL -shared $(SOURCES) -o ../gui/bin/libwps_h10_5gb.dll 85 @$(CC) $(INCLUDE) $(CFLAGS) -D$(subst libwps_,,$(subst $(EXT),,$@)) $(LDFLAGS) -shared -o $@ $+
97 86
98shared-linux: $(SOURCES) 87clean:
99 @echo CC [IRIVER_H10_5GB] 88 $(RM) $(RESULTS)
100 @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -shared -Wl,-soname,libwps_h10_5gb.so,-olibwps_h10_5gb.so -fPIC $(SOURCES)
101 @$(COPY) libwps_h10_5gb.so ../gui/bin/libwps_h10_5gb.so
diff --git a/utils/wpseditor/libwps/buildall.bat b/utils/wpseditor/libwps/buildall.bat
deleted file mode 100644
index fb66b41904..0000000000
--- a/utils/wpseditor/libwps/buildall.bat
+++ /dev/null
@@ -1,4 +0,0 @@
1@echo off
2FOR /F "tokens=1,2* delims=, " %%i in (targets.txt) do @mingw32-make MODEL=%%j TARGET=%%i build 2>nul
3echo Copying files...
4xcopy /I /Y *.dll ..\gui\bin
diff --git a/utils/wpseditor/libwps/buildall.sh b/utils/wpseditor/libwps/buildall.sh
deleted file mode 100755
index 0f32bb9b9a..0000000000
--- a/utils/wpseditor/libwps/buildall.sh
+++ /dev/null
@@ -1,9 +0,0 @@
1#!/bin/sh
2cat targets.txt | (
3 while read target model
4 do
5 make MODEL=$model TARGET=$target build
6 done
7 cp *.dll ../gui/bin
8 cp *.so ../gui/bin
9)
diff --git a/utils/wpseditor/libwps/cleanall.sh b/utils/wpseditor/libwps/cleanall.sh
deleted file mode 100644
index 15b733a6a7..0000000000
--- a/utils/wpseditor/libwps/cleanall.sh
+++ /dev/null
@@ -1,7 +0,0 @@
1#!/bin/sh
2cat targets.txt | (
3 while read target model
4 do
5 make MODEL=$model TARGET=$target clean
6 done
7)
diff --git a/utils/wpseditor/libwps/src/proxy.c b/utils/wpseditor/libwps/src/proxy.c
index 8f9218e3ff..1e4804cd11 100644
--- a/utils/wpseditor/libwps/src/proxy.c
+++ b/utils/wpseditor/libwps/src/proxy.c
@@ -23,8 +23,8 @@ pfdebugf dbgf = 0;
23static char pluginbuf[PLUGIN_BUFFER_SIZE]; 23static char pluginbuf[PLUGIN_BUFFER_SIZE];
24 24
25const char* get_model_name(){ 25const char* get_model_name(){
26#ifdef TARGET_MODEL 26#ifdef MODEL_NAME
27 return TARGET_MODEL; 27 return MODEL_NAME;
28#else 28#else
29 return "unknown"; 29 return "unknown";
30#endif 30#endif
diff --git a/utils/wpseditor/libwps/targets.txt b/utils/wpseditor/libwps/targets.txt
deleted file mode 100644
index 547a2ba42c..0000000000
--- a/utils/wpseditor/libwps/targets.txt
+++ /dev/null
@@ -1,9 +0,0 @@
1IRIVER_H10 h10
2IRIVER_H10_5GB h10_5gb
3IPOD_COLOR ipodcolor
4IPOD_NANO ipodnano
5IPOD_VIDEO ipodvideo
6GIGABEAT_F gigabeatf
7GIGABEAT_S gigabeats
8SANSA_E200 e200
9SANSA_C200 c200
diff --git a/utils/wpseditor/screenshot/Makefile b/utils/wpseditor/screenshot/Makefile
index 18a6de35a5..f9309f58a5 100644
--- a/utils/wpseditor/screenshot/Makefile
+++ b/utils/wpseditor/screenshot/Makefile
@@ -8,31 +8,17 @@
8# 8#
9ROOT=../../.. 9ROOT=../../..
10 10
11OS = w32
12CC = gcc
13
14ifeq ($(findstring MINGW,$(shell uname)),MINGW)
15OS = w32
16CC = mingw32-gcc
17RM = rm
18endif
19
20ifeq ($(findstring Linux,$(shell uname)),Linux)
21OS = linux
22CC = gcc 11CC = gcc
23RM = rm -f 12RM = rm -f
24endif
25
26
27 13
28COMMON= main.c gd_bmp.c 14COMMON = main.c gd_bmp.c
29 15
30INCLUDE=-I ../libwps/src \ 16INCLUDE = -I ../libwps/src \
31 -I $(ROOT)/apps/gui \ 17 -I $(ROOT)/apps/gui \
32 -I $(ROOT)/firmware/export \ 18 -I $(ROOT)/firmware/export \
33 -I $(ROOT)/apps/recorder \ 19 -I $(ROOT)/apps/recorder \
34 -I $(ROOT)/apps \ 20 -I $(ROOT)/apps \
35 -I . 21 -I .
36 22
37CFLAGS = -g -Wall 23CFLAGS = -g -Wall
38 24
diff --git a/utils/wpseditor/wpseditor.pro b/utils/wpseditor/wpseditor.pro
index 0e9ecbbf51..df954ed68a 100644
--- a/utils/wpseditor/wpseditor.pro
+++ b/utils/wpseditor/wpseditor.pro
@@ -1,2 +1,4 @@
1SUBDIRS =gui/src/QPropertyEditor gui
2TEMPLATE = subdirs 1TEMPLATE = subdirs
2SUBDIRS = gui/src/QPropertyEditor gui libwps
3libwps.commands = @$(MAKE) -C libwps
4QMAKE_EXTRA_TARGETS += libwps