summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/wpseditor/README11
-rw-r--r--utils/wpseditor/TODO18
-rw-r--r--utils/wpseditor/buildall.bat9
-rwxr-xr-xutils/wpseditor/buildall.sh4
-rw-r--r--utils/wpseditor/gui/gui.pro12
-rw-r--r--utils/wpseditor/gui/src/QPropertyEditor/QPropertyEditor.pro2
-rw-r--r--utils/wpseditor/gui/src/qsyntaxer.cpp44
-rw-r--r--utils/wpseditor/gui/src/qsyntaxer.h21
-rw-r--r--utils/wpseditor/gui/src/qtrackstate.h5
-rw-r--r--utils/wpseditor/gui/src/qwpsdrawer.cpp112
-rw-r--r--utils/wpseditor/gui/src/qwpsdrawer.h27
-rw-r--r--utils/wpseditor/gui/src/qwpsdrawer_static.cpp7
-rw-r--r--utils/wpseditor/gui/src/qwpseditorwindow.cpp70
-rw-r--r--utils/wpseditor/gui/src/qwpseditorwindow.h18
-rw-r--r--utils/wpseditor/gui/src/slider.cpp7
-rw-r--r--utils/wpseditor/gui/src/slider.h1
-rw-r--r--utils/wpseditor/gui/src/utils.cpp1
-rw-r--r--utils/wpseditor/gui/src/utils.h1
-rw-r--r--utils/wpseditor/gui/ui/mainwindow.ui40
-rw-r--r--utils/wpseditor/libwps/Makefile55
-rw-r--r--utils/wpseditor/libwps/buildall.bat4
-rwxr-xr-x[-rw-r--r--]utils/wpseditor/libwps/buildall.sh2
-rw-r--r--utils/wpseditor/libwps/src/api.c36
-rw-r--r--utils/wpseditor/libwps/src/proxy.c9
-rw-r--r--utils/wpseditor/libwps/src/proxy.h6
-rw-r--r--utils/wpseditor/libwps/targets.txt24
26 files changed, 360 insertions, 186 deletions
diff --git a/utils/wpseditor/README b/utils/wpseditor/README
index 3a8b87c511..c2b6a62866 100644
--- a/utils/wpseditor/README
+++ b/utils/wpseditor/README
@@ -7,15 +7,18 @@
7 7
8Installation 8Installation
9 9
10To make a release version, change value in CONFIG from "debug" to "release" in gui.pro and QPropertyEditor.pro.
11
10Windows: 12Windows:
11 13
12 * be sure that you have properly installed mingw, QT > 4.3.* 14 * be sure that you have properly installed mingw, QT > 4.3.* and bin directories are set properly
13 * if you want to debug wpseditor, you'll have to build Qt debug libraries 15 * if you want to debug wpseditor, you'll have to build Qt debug libraries
14 * cd to rockbox/utils/wpseditor/ from Qt command promt and run qmake and then make 16 * if you haven't qmake from PATH enviromet use Qts command line.
15 * >gui\bin\wpseditor.exe 17 * run 'buildall.bat' in utils\wpseditor\
18 * the binary is then in utils\wpseditor\gui\bin\wpseditord.exe
16 19
17Linux: 20Linux:
18 21
19 * Make sure you have libqt4-dev installed and you have a working Rockbox environment 22 * Make sure you have libqt4-dev installed and you have a working Rockbox environment
20 * cd to utils/wpseditor/ and do 'qmake-qt4 && make' 23 * cd to utils/wpseditor/ and run 'buildall.sh'
21 * cd to gui/bin/ and start WPS editor with './wpseditord' 24 * cd to gui/bin/ and start WPS editor with './wpseditord'
diff --git a/utils/wpseditor/TODO b/utils/wpseditor/TODO
index 28f559111f..0fb4afca86 100644
--- a/utils/wpseditor/TODO
+++ b/utils/wpseditor/TODO
@@ -1,7 +1,19 @@
1* Enable ability in gui to load different targets on the fly 1* Make better logging system
2* Replace checkwps functionality
3* Include 'screenshot utility' functionality
4* Options
2* Enable animation(timers,sliding lines, etc) 5* Enable animation(timers,sliding lines, etc)
3* Test on Mac OS 6* Test on Mac OS
4* Redesign GUI for more usability 7* Redesign GUI for more usability
5* Replace checkwps functionality
6* Include 'screenshot utility' functionality
7* Make editing via gui 8* Make editing via gui
9* Use native rockbox fonts
10* Replace shared libs as Qt Plugins
11* Edit wiki :-)
12
13Partially solved
14* Enable ability in gui to load different targets on the fly [Not all targets are built yet]
15* Syntax highlight [Comments are done; enable for logEdit; tag highlight]
16
17THE BUGZ ARE COMING!
18* While loading wps for the first time, gui doesn't show properties from editor properly
19* Strange text horisontal position in cabbie(probably other themes)
diff --git a/utils/wpseditor/buildall.bat b/utils/wpseditor/buildall.bat
new file mode 100644
index 0000000000..c550a30850
--- /dev/null
+++ b/utils/wpseditor/buildall.bat
@@ -0,0 +1,9 @@
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
new file mode 100755
index 0000000000..2539ba2161
--- /dev/null
+++ b/utils/wpseditor/buildall.sh
@@ -0,0 +1,4 @@
1#!/bin/sh
2qmake && make
3cd libwps
4./buildall.sh 2> /dev/null
diff --git a/utils/wpseditor/gui/gui.pro b/utils/wpseditor/gui/gui.pro
index db7cfa1343..ada7ea3c98 100644
--- a/utils/wpseditor/gui/gui.pro
+++ b/utils/wpseditor/gui/gui.pro
@@ -8,10 +8,7 @@ MOC_DIR = build
8UI_DIR = build 8UI_DIR = build
9QMAKE_LIBDIR += lib 9QMAKE_LIBDIR += lib
10QT = gui core 10QT = gui core
11CONFIG += qt warn_on console debug_and_release 11CONFIG += qt warn_on debug
12libwps.commands += $(MAKE) -C ../libwps shared
13QMAKE_EXTRA_TARGETS += libwps
14PRE_TARGETDEPS += libwps
15HEADERS += ../libwps/src/api.h \ 12HEADERS += ../libwps/src/api.h \
16 ../libwps/src/defs.h \ 13 ../libwps/src/defs.h \
17 src/slider.h \ 14 src/slider.h \
@@ -19,7 +16,8 @@ HEADERS += ../libwps/src/api.h \
19 src/qwpsstate.h \ 16 src/qwpsstate.h \
20 src/qwpseditorwindow.h \ 17 src/qwpseditorwindow.h \
21 src/utils.h \ 18 src/utils.h \
22 src/qwpsdrawer.h 19 src/qwpsdrawer.h \
20 src/qsyntaxer.h
23FORMS += ui/mainwindow.ui ui/slider.ui 21FORMS += ui/mainwindow.ui ui/slider.ui
24SOURCES += src/main.cpp \ 22SOURCES += src/main.cpp \
25 src/slider.cpp \ 23 src/slider.cpp \
@@ -28,11 +26,13 @@ SOURCES += src/main.cpp \
28 src/qwpseditorwindow.cpp \ 26 src/qwpseditorwindow.cpp \
29 src/utils.cpp \ 27 src/utils.cpp \
30 src/qwpsdrawer.cpp \ 28 src/qwpsdrawer.cpp \
31 src/qwpsdrawer_static.cpp 29 src/qwpsdrawer_static.cpp \
30 src/qsyntaxer.cpp
32LIBS += -Lbin 31LIBS += -Lbin
33CONFIG(debug, debug|release) { 32CONFIG(debug, debug|release) {
34 LIBS += -lQPropertyEditord 33 LIBS += -lQPropertyEditord
35 TARGET = wpseditord 34 TARGET = wpseditord
35 CONFIG += console
36} 36}
37CONFIG(release, debug|release) { 37CONFIG(release, debug|release) {
38 LIBS += -lQPropertyEditor 38 LIBS += -lQPropertyEditor
diff --git a/utils/wpseditor/gui/src/QPropertyEditor/QPropertyEditor.pro b/utils/wpseditor/gui/src/QPropertyEditor/QPropertyEditor.pro
index 85fd29ee2c..ad1e31ce9a 100644
--- a/utils/wpseditor/gui/src/QPropertyEditor/QPropertyEditor.pro
+++ b/utils/wpseditor/gui/src/QPropertyEditor/QPropertyEditor.pro
@@ -1,5 +1,5 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += staticlib debug_and_release 2CONFIG += staticlib debug
3SOURCES = ColorCombo.cpp \ 3SOURCES = ColorCombo.cpp \
4 Property.cpp \ 4 Property.cpp \
5 QPropertyEditorWidget.cpp \ 5 QPropertyEditorWidget.cpp \
diff --git a/utils/wpseditor/gui/src/qsyntaxer.cpp b/utils/wpseditor/gui/src/qsyntaxer.cpp
new file mode 100644
index 0000000000..412ca38148
--- /dev/null
+++ b/utils/wpseditor/gui/src/qsyntaxer.cpp
@@ -0,0 +1,44 @@
1#include <QTextCharFormat>
2
3#include "qsyntaxer.h"
4
5QSyntaxer::QSyntaxer(QTextDocument *parent)
6 : QSyntaxHighlighter(parent) {
7 HighlightingRule rule;
8
9 hrules["operator"].pattern = QRegExp("%[^\\| \n<\\?%]{1,2}");
10 hrules["operator"].format.setFontWeight(QFont::Bold);
11 hrules["operator"].format.setForeground(Qt::darkBlue);
12
13
14 hrules["question"].pattern = QRegExp("%[\\?]{1}[^<]{1,2}");
15 hrules["question"].format.setForeground(Qt::darkMagenta);
16
17 hrules["question2"].pattern = QRegExp("(<|>)");
18 hrules["question2"].format.setForeground(Qt::red);
19
20
21 hrules["limiter"].pattern = QRegExp("\\|");
22 hrules["limiter"].format.setForeground(Qt::darkRed);
23
24 hrules["comment"].pattern = QRegExp("#[^\n]*");
25 hrules["comment"].format.setForeground(Qt::darkGreen);
26 hrules["comment"].format.setFontItalic(true);
27}
28//
29void QSyntaxer::highlightBlock(const QString &text) {
30 QTextCharFormat wholeText;
31 wholeText.setFont(QFont("arial",11,QFont::Normal));
32 setFormat(0,text.length(),wholeText);
33
34 foreach (HighlightingRule rule, hrules) {
35 QRegExp expression(rule.pattern);
36 int index = text.indexOf(expression);
37 while (index >= 0) {
38 int length = expression.matchedLength();
39 setFormat(index, length, rule.format);
40 index = text.indexOf(expression, index + length);
41 }
42 }
43
44}
diff --git a/utils/wpseditor/gui/src/qsyntaxer.h b/utils/wpseditor/gui/src/qsyntaxer.h
new file mode 100644
index 0000000000..9cecd3e5ed
--- /dev/null
+++ b/utils/wpseditor/gui/src/qsyntaxer.h
@@ -0,0 +1,21 @@
1#ifndef QSYNTAXER_H
2#define QSYNTAXER_H
3//
4#include <QSyntaxHighlighter>
5
6class QTextCharFormat;
7
8class QSyntaxer : public QSyntaxHighlighter {
9 Q_OBJECT
10 struct HighlightingRule {
11 QRegExp pattern;
12 QTextCharFormat format;
13 };
14 QMap<QString,HighlightingRule> hrules;
15public:
16 QSyntaxer(QTextDocument *parent = 0);
17
18protected:
19 void highlightBlock(const QString &text);
20};
21#endif
diff --git a/utils/wpseditor/gui/src/qtrackstate.h b/utils/wpseditor/gui/src/qtrackstate.h
index b57f7a8376..9c3f324be6 100644
--- a/utils/wpseditor/gui/src/qtrackstate.h
+++ b/utils/wpseditor/gui/src/qtrackstate.h
@@ -4,11 +4,9 @@
4#include "wpsstate.h" 4#include "wpsstate.h"
5#include <QObject> 5#include <QObject>
6 6
7class QWpsState;
8
9class QTrackState : public QObject { 7class QTrackState : public QObject {
10 Q_OBJECT 8 Q_OBJECT
11 Q_CLASSINFO ( "QTrackState", "Mp3 State" ); 9 Q_CLASSINFO ( "QTrackState", "Track State" );
12 Q_PROPERTY ( QString Title READ title WRITE setTitle DESIGNABLE true USER true ) 10 Q_PROPERTY ( QString Title READ title WRITE setTitle DESIGNABLE true USER true )
13 Q_PROPERTY ( QString Artist READ artist WRITE setArtist DESIGNABLE true USER true ) 11 Q_PROPERTY ( QString Artist READ artist WRITE setArtist DESIGNABLE true USER true )
14 Q_PROPERTY ( QString Album READ album WRITE setAlbum DESIGNABLE true USER true ) 12 Q_PROPERTY ( QString Album READ album WRITE setAlbum DESIGNABLE true USER true )
@@ -17,7 +15,6 @@ class QTrackState : public QObject {
17 Q_PROPERTY ( int Elapsed READ elapsed WRITE setElapsed DESIGNABLE true USER true ) 15 Q_PROPERTY ( int Elapsed READ elapsed WRITE setElapsed DESIGNABLE true USER true )
18 Q_CLASSINFO("Elapsed", "minimum=0;maximum=100;value=50"); 16 Q_CLASSINFO("Elapsed", "minimum=0;maximum=100;value=50");
19 17
20
21 trackstate state; 18 trackstate state;
22 19
23public: 20public:
diff --git a/utils/wpseditor/gui/src/qwpsdrawer.cpp b/utils/wpseditor/gui/src/qwpsdrawer.cpp
index ab8a4b32d6..a506d5c03b 100644
--- a/utils/wpseditor/gui/src/qwpsdrawer.cpp
+++ b/utils/wpseditor/gui/src/qwpsdrawer.cpp
@@ -1,11 +1,14 @@
1#include "qwpsdrawer.h" 1#include <stdarg.h>
2#include "slider.h" 2
3#include "utils.h"
4#include <QtGui> 3#include <QtGui>
5#include <QLibrary> 4#include <QLibrary>
6#include <stdarg.h>
7//
8 5
6#include "qwpsdrawer.h"
7#include "slider.h"
8#include "utils.h"
9#include "qtrackstate.h"
10#include "qwpsstate.h"
11#include "api.h"
9 12
10QPointer<QWpsDrawer> drawer; 13QPointer<QWpsDrawer> drawer;
11QPixmap *QWpsDrawer::pix = NULL; 14QPixmap *QWpsDrawer::pix = NULL;
@@ -14,34 +17,38 @@ QImage QWpsDrawer::backdrop;
14proxy_api QWpsDrawer::api; 17proxy_api QWpsDrawer::api;
15 18
16QWpsDrawer::QWpsDrawer( QWpsState *ws,QTrackState *ms, QWidget *parent ) 19QWpsDrawer::QWpsDrawer( QWpsState *ws,QTrackState *ms, QWidget *parent )
17 : QWidget(parent),wpsState(ws),trackState(ms),showGrid(false),mTargetLibName("libwps") { 20 : QWidget(parent),wpsState(ws),trackState(ms),showGrid(false),mCurTarget("h10_5gb") {
18 21
19 tryResolve(); 22 tryResolve();
20 memset(&api,0,sizeof(struct proxy_api));
21
22 api.verbose = 2;
23 api.putsxy = &QWpsDrawer::putsxy;
24 api.transparent_bitmap_part = &QWpsDrawer::transparent_bitmap_part;
25 api.bitmap_part = &QWpsDrawer::bitmap_part;
26 api.drawpixel = &QWpsDrawer::drawpixel;
27 api.fillrect = &QWpsDrawer::fillrect;
28 api.hline = &QWpsDrawer::hline;
29 api.vline = &QWpsDrawer::vline;
30 api.clear_viewport = &QWpsDrawer::clear_viewport;
31 api.load_wps_backdrop = &QWpsDrawer::load_wps_backdrop;
32 api.read_bmp_file = &QWpsDrawer::read_bmp_file;
33 api.debugf = &qlogger;
34 newTempWps(); 23 newTempWps();
35} 24}
36 25
37bool QWpsDrawer::tryResolve() { 26bool QWpsDrawer::tryResolve() {
38 QLibrary lib(qApp->applicationDirPath()+"/"+mTargetLibName); 27 QLibrary lib(qApp->applicationDirPath()+"/libwps_"+mCurTarget);
39 wps_init = (pfwps_init)lib.resolve("wps_init"); 28 lib_wps_init = (pfwps_init)lib.resolve("wps_init");
40 wps_display = (pfwps_display)lib.resolve("wps_display"); 29 lib_wps_display = (pfwps_display)lib.resolve("wps_display");
41 wps_refresh = (pfwps_refresh)lib.resolve("wps_refresh"); 30 lib_wps_refresh = (pfwps_refresh)lib.resolve("wps_refresh");
42 mResolved = wps_init && wps_display && wps_refresh; 31 lib_get_model_name = (pfget_model_name)lib.resolve("get_model_name");
32 mResolved = lib_wps_init && lib_wps_display && lib_wps_refresh && lib_get_model_name;
43 if (!mResolved) 33 if (!mResolved)
44 DEBUGF1(tr("ERR: Failed to resolve funcs!")); 34 DEBUGF1(tr("ERR: Failed to resolve funcs!"));
35 else {
36 int v = api.verbose;
37 memset(&api,0,sizeof(struct proxy_api));
38 api.verbose = v;
39 api.putsxy = &QWpsDrawer::putsxy;
40 api.transparent_bitmap_part = &QWpsDrawer::transparent_bitmap_part;
41 api.bitmap_part = &QWpsDrawer::bitmap_part;
42 api.drawpixel = &QWpsDrawer::drawpixel;
43 api.fillrect = &QWpsDrawer::fillrect;
44 api.hline = &QWpsDrawer::hline;
45 api.vline = &QWpsDrawer::vline;
46 api.clear_viewport = &QWpsDrawer::clear_viewport;
47 api.load_wps_backdrop = &QWpsDrawer::load_wps_backdrop;
48 api.read_bmp_file = &QWpsDrawer::read_bmp_file;
49 api.debugf = &qlogger;
50 qDebug()<<(qApp->applicationDirPath()+"/libwps_"+mCurTarget+" resolved");
51 }
45 return mResolved; 52 return mResolved;
46} 53}
47QWpsDrawer::~QWpsDrawer() { 54QWpsDrawer::~QWpsDrawer() {
@@ -56,20 +63,20 @@ void QWpsDrawer::mouseReleaseEvent ( QMouseEvent * event ) {
56 DEBUGF1("x=%d,y=%d",x,y);*/ 63 DEBUGF1("x=%d,y=%d",x,y);*/
57} 64}
58void QWpsDrawer::newTempWps() { 65void QWpsDrawer::newTempWps() {
59 QTemporaryFile tmpWps; 66 QTemporaryFile tmpWps;
60 tmpWps.setAutoRemove(false); 67 tmpWps.setAutoRemove(false);
61 tmpWps.setFileTemplate(QDir::tempPath()+"/XXXXXXXXXX.wps"); 68 tmpWps.setFileTemplate(QDir::tempPath()+"/XXXXXXXXXX.wps");
62 if (tmpWps.open()) { 69 if (tmpWps.open()) {
63 QString tmpDir = tmpWps.fileName().left(tmpWps.fileName().length()-4); 70 QString tmpDir = tmpWps.fileName().left(tmpWps.fileName().length()-4);
64 if (QDir::temp().mkpath(tmpDir)) { 71 if (QDir::temp().mkpath(tmpDir)) {
65 mTmpWpsString = tmpDir; 72 mTmpWpsString = tmpDir;
66 DEBUGF1(mTmpWpsString); 73 DEBUGF3(QString("Created :"+mTmpWpsString).toAscii());
67 } 74 }
68 } 75 }
69} 76}
70 77
71void QWpsDrawer::WpsInit(QString buffer, bool isFile) { 78void QWpsDrawer::WpsInit(QString buffer, bool isFile) {
72 79 DEBUGF3("QWpsDrawer::WpsInit");
73 if (!mResolved) 80 if (!mResolved)
74 if (!tryResolve()) 81 if (!tryResolve())
75 return; 82 return;
@@ -87,22 +94,24 @@ void QWpsDrawer::WpsInit(QString buffer, bool isFile) {
87 if (tfile.open(QIODevice::WriteOnly | QIODevice::Text)) 94 if (tfile.open(QIODevice::WriteOnly | QIODevice::Text))
88 tfile.write(mWpsString.toAscii(),mWpsString.length()); 95 tfile.write(mWpsString.toAscii(),mWpsString.length());
89 } 96 }
90 97 backdrop.fill(Qt::black);
98 DEBUGF3("clear backdrop");
91 if (isFile) 99 if (isFile)
92 wps_init(buffer.toAscii(), &api, isFile); 100 lib_wps_init(buffer.toAscii(), &api, isFile);
93 else 101 else
94 wps_init(QString(mTmpWpsString+".wps").toAscii(), &api, true); 102 lib_wps_init(QString(mTmpWpsString+".wps").toAscii(), &api, true);
95 pix = new QPixmap(api.getwidth(),api.getheight()); 103 pix = new QPixmap(api.getwidth(),api.getheight());
104 pix->fill(Qt::black);
96 105
97 drawBackdrop(); 106 drawBackdrop();
98 107
99 setMinimumWidth(api.getwidth()); 108 setMinimumWidth(api.getwidth());
100 setMinimumHeight(api.getheight()); 109 setMinimumHeight(api.getheight());
101
102 update(); 110 update();
103} 111}
104 112
105void QWpsDrawer::paintEvent(QPaintEvent * event) { 113void QWpsDrawer::paintEvent(QPaintEvent * event) {
114 DEBUGF3("QWpsDrawer::paintEvent()");
106 if (!mResolved) 115 if (!mResolved)
107 return; 116 return;
108 if (pix==NULL) 117 if (pix==NULL)
@@ -111,7 +120,7 @@ void QWpsDrawer::paintEvent(QPaintEvent * event) {
111 QRect rect = event->rect(); 120 QRect rect = event->rect();
112 121
113 drawBackdrop(); 122 drawBackdrop();
114 wps_refresh(); 123 lib_wps_refresh();
115 124
116 if (showGrid) { 125 if (showGrid) {
117 QPainter g(pix); 126 QPainter g(pix);
@@ -172,10 +181,13 @@ void QWpsDrawer::slotShowGrid(bool show) {
172} 181}
173 182
174void QWpsDrawer::drawBackdrop() { 183void QWpsDrawer::drawBackdrop() {
184 DEBUGF3("QWpsDrawer::drawBackdrop()");
185 if (backdrop.isNull())
186 return;
175 QPainter b(pix); 187 QPainter b(pix);
176 QImage pink = backdrop.createMaskFromColor(qRgb(255,0,255),Qt::MaskOutColor); 188 QImage pink = backdrop.createMaskFromColor(qRgb(255,0,255),Qt::MaskOutColor);
177 backdrop.setAlphaChannel(pink); 189 backdrop.setAlphaChannel(pink);
178 b.drawImage(0,0,backdrop); 190 b.drawImage(0,0,backdrop,0,0,pix->width(),pix->height());
179} 191}
180 192
181void QWpsDrawer::slotSetAudioStatus(int status) { 193void QWpsDrawer::slotSetAudioStatus(int status) {
@@ -198,3 +210,35 @@ void QWpsDrawer::closeEvent(QCloseEvent *event) {
198 cleanTemp(); 210 cleanTemp();
199 event->accept(); 211 event->accept();
200} 212}
213
214QString QWpsDrawer::getModelName(QString libraryName) {
215 QLibrary lib(libraryName);
216 if ((pfget_model_name)lib.resolve("get_model_name"))
217 return ((pfget_model_name)lib.resolve("get_model_name"))();
218 DEBUGF1("ERR: failed to resolve <get_model_name>");
219 return "unknown";
220}
221
222QList<QString> QWpsDrawer::getTargets() {
223 QList<QString> list ;
224 QDir d = QDir(qApp->applicationDirPath());
225 QFileInfoList libs = d.entryInfoList(QStringList("libwps*"));
226 qDebug() << libs.size()<<"libs found";
227 for (int i = 0; i < libs.size(); i++) {
228 QString modelName = getModelName(libs[i].absoluteFilePath());
229 qDebug() << libs[i].fileName()<<modelName;
230 if (modelName == "unknown")
231 continue;
232 list.append(modelName);
233 }
234 return list;
235}
236bool QWpsDrawer::setTarget(QString target) {
237 QLibrary lib(qApp->applicationDirPath()+"/libwps_"+mCurTarget);
238 //lib.unload();
239 if (getModelName("libwps_"+target)!="unknown") {
240 mCurTarget = target;
241 return tryResolve();
242 }
243 return false;
244}
diff --git a/utils/wpseditor/gui/src/qwpsdrawer.h b/utils/wpseditor/gui/src/qwpsdrawer.h
index d4dfa6c7a2..65e98723f5 100644
--- a/utils/wpseditor/gui/src/qwpsdrawer.h
+++ b/utils/wpseditor/gui/src/qwpsdrawer.h
@@ -1,25 +1,30 @@
1#ifndef WPSDRAWER_H 1#ifndef WPSDRAWER_H
2#define WPSDRAWER_H 2#define WPSDRAWER_H
3// 3
4#include <QWidget> 4#include <QWidget>
5#include <QPixmap> 5#include <QPixmap>
6#include <QPointer> 6#include <QPointer>
7#include <QTemporaryFile> 7#include <QTemporaryFile>
8#include "api.h" 8
9#include "qtrackstate.h" 9#include "wpsstate.h"
10#include "qwpsstate.h" 10
11// 11struct proxy_api;
12
13class QWpsState;
14class QTrackState;
12 15
13typedef int (*pfwps_init)(const char* buff,struct proxy_api *api, bool isfile); 16typedef int (*pfwps_init)(const char* buff,struct proxy_api *api, bool isfile);
14typedef int (*pfwps_display)(); 17typedef int (*pfwps_display)();
15typedef int (*pfwps_refresh)(); 18typedef int (*pfwps_refresh)();
19typedef const char* (*pfget_model_name)();
16 20
17class QWpsDrawer : public QWidget { 21class QWpsDrawer : public QWidget {
18 Q_OBJECT 22 Q_OBJECT
19 23
20 pfwps_init wps_init; 24 pfwps_init lib_wps_init;
21 pfwps_display wps_display; 25 pfwps_display lib_wps_display;
22 pfwps_refresh wps_refresh; 26 pfwps_refresh lib_wps_refresh;
27 pfget_model_name lib_get_model_name;
23 28
24 static QPixmap *pix; 29 static QPixmap *pix;
25 static QImage backdrop; 30 static QImage backdrop;
@@ -30,7 +35,7 @@ class QWpsDrawer : public QWidget {
30 bool showGrid; 35 bool showGrid;
31 bool mResolved; 36 bool mResolved;
32 QString mWpsString; 37 QString mWpsString;
33 QString mTargetLibName; 38 QString mCurTarget;
34 static QString mTmpWpsString; 39 static QString mTmpWpsString;
35 40
36 41
@@ -42,6 +47,7 @@ protected:
42 void newTempWps(); 47 void newTempWps();
43 void cleanTemp(bool fileToo=true); 48 void cleanTemp(bool fileToo=true);
44 bool tryResolve(); 49 bool tryResolve();
50 QString getModelName(QString libraryName);
45public: 51public:
46 QWpsDrawer(QWpsState *ws,QTrackState *ms, QWidget *parent=0); 52 QWpsDrawer(QWpsState *ws,QTrackState *ms, QWidget *parent=0);
47 ~QWpsDrawer(); 53 ~QWpsDrawer();
@@ -53,6 +59,8 @@ public:
53 QString tempWps() const { 59 QString tempWps() const {
54 return mTmpWpsString; 60 return mTmpWpsString;
55 }; 61 };
62 QList<QString> getTargets();
63 bool setTarget(QString target);
56 64
57 65
58 static proxy_api api; 66 static proxy_api api;
@@ -73,7 +81,6 @@ public:
73public slots: 81public slots:
74 void slotSetVolume(); 82 void slotSetVolume();
75 void slotSetProgress(); 83 void slotSetProgress();
76
77 void slotShowGrid(bool); 84 void slotShowGrid(bool);
78 void slotWpsStateChanged(wpsstate); 85 void slotWpsStateChanged(wpsstate);
79 void slotTrackStateChanged(trackstate); 86 void slotTrackStateChanged(trackstate);
diff --git a/utils/wpseditor/gui/src/qwpsdrawer_static.cpp b/utils/wpseditor/gui/src/qwpsdrawer_static.cpp
index bf94d28a5a..a9346ae430 100644
--- a/utils/wpseditor/gui/src/qwpsdrawer_static.cpp
+++ b/utils/wpseditor/gui/src/qwpsdrawer_static.cpp
@@ -3,14 +3,14 @@
3#include <QFile> 3#include <QFile>
4#include <QFileInfo> 4#include <QFileInfo>
5#include "utils.h" 5#include "utils.h"
6#include "api.h"
6 7
7void QWpsDrawer::putsxy(int x, int y, const unsigned char *str) { 8void QWpsDrawer::putsxy(int x, int y, const unsigned char *str) {
9 DEBUGF3("putsxy(int x=%d, int y=%d, *str=%s)",x,y,str);
8 QPainter p(pix); 10 QPainter p(pix);
9 viewport_api avp; 11 viewport_api avp;
10 api.get_current_vp(&avp); 12 api.get_current_vp(&avp);
11 p.setPen(Qt::gray); 13 p.setPen(Qt::gray);
12
13
14 QFont font("times",avp.fontheight,QFont::Bold); 14 QFont font("times",avp.fontheight,QFont::Bold);
15 p.setFont(font); 15 p.setFont(font);
16 p.drawText(x+avp.x,y + avp.fontheight + avp.y,(char*)str); 16 p.drawText(x+avp.x,y + avp.fontheight + avp.y,(char*)str);
@@ -54,7 +54,7 @@ void QWpsDrawer::vline(int x, int y1, int y2) {
54 p.drawLine(x,y1,x,y2); 54 p.drawLine(x,y1,x,y2);
55} 55}
56bool QWpsDrawer::load_wps_backdrop(char* filename) { 56bool QWpsDrawer::load_wps_backdrop(char* filename) {
57 DEBUGF2("load backdrop: %s", filename); 57 DEBUGF3("load backdrop: %s", filename);
58 QFile file(filename); 58 QFile file(filename);
59 QFileInfo info(file); 59 QFileInfo info(file);
60 file.copy(mTmpWpsString+"/"+info.fileName()); 60 file.copy(mTmpWpsString+"/"+info.fileName());
@@ -70,7 +70,6 @@ int QWpsDrawer::read_bmp_file(const char* filename,int *width, int *height) {
70 file.copy(mTmpWpsString+"/"+info.fileName()); 70 file.copy(mTmpWpsString+"/"+info.fileName());
71 71
72 img.load(filename); 72 img.load(filename);
73 //qDebug()<<"QWpsDrawer::read_bmp_file"<<img.width()<<img.height();
74 *width = img.width(); 73 *width = img.width();
75 *height = img.height(); 74 *height = img.height();
76 return 1; 75 return 1;
diff --git a/utils/wpseditor/gui/src/qwpseditorwindow.cpp b/utils/wpseditor/gui/src/qwpseditorwindow.cpp
index c3090bd027..74d18ffe23 100644
--- a/utils/wpseditor/gui/src/qwpseditorwindow.cpp
+++ b/utils/wpseditor/gui/src/qwpseditorwindow.cpp
@@ -1,9 +1,11 @@
1#include "qwpseditorwindow.h"
2#include "qwpsdrawer.h"
3#include "utils.h"
4#include <QFileDialog> 1#include <QFileDialog>
5#include <QDebug> 2#include <QDebug>
6#include <QInputDialog> 3#include <QInputDialog>
4#include "api.h"
5#include "qwpseditorwindow.h"
6#include "utils.h"
7#include "qsyntaxer.h"
8
7 9
8enum api_playmode playmodes[PLAYMODES_NUM] = { 10enum api_playmode playmodes[PLAYMODES_NUM] = {
9 API_STATUS_PLAY, 11 API_STATUS_PLAY,
@@ -27,45 +29,61 @@ QWpsEditorWindow::QWpsEditorWindow( QWidget * parent, Qt::WFlags f)
27 setupUi(this); 29 setupUi(this);
28 drawer = new QWpsDrawer(&wpsState,&trackState, this); 30 drawer = new QWpsDrawer(&wpsState,&trackState, this);
29 QWpsDrawer::api.verbose = 1; 31 QWpsDrawer::api.verbose = 1;
30 //drawer->WpsInit("iCatcher.wps");
31 setCentralWidget(drawer); 32 setCentralWidget(drawer);
32 connectActions(); 33 connectActions();
33 m_propertyEditor->addObject(&trackState); 34 m_propertyEditor->addObject(&trackState);
34 m_propertyEditor->addObject(&wpsState); 35 m_propertyEditor->addObject(&wpsState);
36 new QSyntaxer(plainWpsEdit->document());
35} 37}
36 38
37void QWpsEditorWindow::connectActions() { 39void QWpsEditorWindow::connectActions() {
38 qDebug()<<"connect actions"; 40 DEBUGF3("connect actions");
39 connect(actOpenWps, SIGNAL(triggered()), this, SLOT(slotOpenWps())); 41 connect(actOpenWps, SIGNAL(triggered()), this, SLOT(slotOpenWps()));
40 connect(actSetVolume, SIGNAL(triggered()), drawer, SLOT(slotSetVolume())); 42 connect(actSetVolume, SIGNAL(triggered()), drawer, SLOT(slotSetVolume()));
41 connect(actSetProgress, SIGNAL(triggered()), drawer, SLOT(slotSetProgress())); 43 connect(actSetProgress, SIGNAL(triggered()), drawer, SLOT(slotSetProgress()));
42 connect(actShowGrid, SIGNAL(triggered(bool)), drawer, SLOT(slotShowGrid(bool))); 44 connect(actShowGrid, SIGNAL(triggered(bool)), drawer, SLOT(slotShowGrid(bool)));
43 45
44 connect(actUpdatePlainWps, SIGNAL(triggered()), SLOT(slotUpdatePlainWps())); 46 connect(actUpdatePlainWps, SIGNAL(triggered()), SLOT(slotUpdatePlainWps()));
45 connect(plainWpsEdit->document(), SIGNAL(modificationChanged(bool)), SLOT(slotPlainDocModChanged(bool))); 47 connect(plainWpsEdit->document(),SIGNAL(modificationChanged(bool)),SLOT(slotPlainDocModChanged(bool)));
46 48
47 connect(&wpsState, SIGNAL(stateChanged(wpsstate)), drawer, SLOT(slotWpsStateChanged(wpsstate))); 49 connect(&wpsState, SIGNAL(stateChanged(wpsstate)), drawer, SLOT(slotWpsStateChanged(wpsstate)));
48 connect(&trackState, SIGNAL(stateChanged(trackstate)), drawer, SLOT(slotTrackStateChanged(trackstate))); 50 connect(&trackState, SIGNAL(stateChanged(trackstate)), drawer, SLOT(slotTrackStateChanged(trackstate)));
49 connect(&wpsState, SIGNAL(stateChanged(wpsstate)), this, SLOT(slotWpsStateChanged(wpsstate))); 51 connect(&wpsState, SIGNAL(stateChanged(wpsstate)), this, SLOT(slotWpsStateChanged(wpsstate)));
50 connect(&trackState, SIGNAL(stateChanged(trackstate)), this, SLOT(slotTrackStateChanged(trackstate))); 52 connect(&trackState, SIGNAL(stateChanged(trackstate)), this, SLOT(slotTrackStateChanged(trackstate)));
51 53
52 connect(actClearLog, SIGNAL(triggered()), logEdit, SLOT(clear())); 54 connect(actClearLog, SIGNAL(triggered()), logEdit, SLOT(clear()));
53 connect(actVerboseLevel, SIGNAL(triggered()), SLOT(slotVerboseLevel())); 55 connect(actVerboseLevel, SIGNAL(triggered()), SLOT(slotVerboseLevel()));
54 56
55 actGroupAudios = new QActionGroup(this); 57 actGroupAudios = new QActionGroup(this);
56 signalMapper = new QSignalMapper(this); 58 audiosSignalMapper = new QSignalMapper(this);
57 for (int i=0;i<PLAYMODES_NUM;i++) { 59 for (int i=0;i<PLAYMODES_NUM;i++) {
58 QAction *act = new QAction(playmodeNames[i],this); 60 QAction *act = new QAction(playmodeNames[i],this);
59 act->setCheckable(true); 61 act->setCheckable(true);
60 actGroupAudios->addAction(act); 62 actGroupAudios->addAction(act);
61 connect(act,SIGNAL(triggered()),signalMapper,SLOT(map())); 63 connect(act,SIGNAL(triggered()),audiosSignalMapper,SLOT(map()));
62 signalMapper->setMapping(act, i); 64 audiosSignalMapper->setMapping(act, i);
63 menuPlay->addAction(act); 65 menuPlay->addAction(act);
64 actAudios[playmodes[i]] = act; 66 actAudios[playmodes[i]] = act;
65 } 67 }
66 connect(signalMapper, SIGNAL(mapped(int)), SIGNAL(signalAudioStatusChanged(int))); 68 connect(audiosSignalMapper, SIGNAL(mapped(int)), SIGNAL(signalAudioStatusChanged(int)));
67 connect(this, SIGNAL(signalAudioStatusChanged(int)), drawer, SLOT(slotSetAudioStatus(int))); 69 connect(this, SIGNAL(signalAudioStatusChanged(int)), drawer, SLOT(slotSetAudioStatus(int)));
68 actGroupAudios->setEnabled(false); 70 actGroupAudios->setEnabled(false);
71
72 QList<QString> targets = drawer->getTargets();
73 actGroupTargets = new QActionGroup(this);
74 targetsSignalMapper = new QSignalMapper(this);
75
76 for (int i=0;i<targets.size();i++) {
77 QAction *act = new QAction(targets[i],this);
78 act->setCheckable(true);
79 actGroupTargets->addAction(act);
80 connect(act,SIGNAL(triggered()),targetsSignalMapper,SLOT(map()));
81 targetsSignalMapper->setMapping(act, targets[i]);
82 menuTarget->addAction(act);
83 actTargets[targets[i]] = act;
84 }
85 connect(targetsSignalMapper, SIGNAL(mapped(const QString &)),this, SIGNAL(signalSetTarget(const QString &)));
86 connect(this, SIGNAL(signalSetTarget(const QString &)),this, SLOT(slotSetTarget(const QString &)));
69} 87}
70 88
71void QWpsEditorWindow::slotWpsStateChanged(wpsstate) { 89void QWpsEditorWindow::slotWpsStateChanged(wpsstate) {
@@ -89,8 +107,9 @@ void QWpsEditorWindow::slotOpenWps() {
89 drawer->WpsInit(wpsfile); 107 drawer->WpsInit(wpsfile);
90 plainWpsEdit->clear(); 108 plainWpsEdit->clear();
91 plainWpsEdit->append(drawer->wpsString()); 109 plainWpsEdit->append(drawer->wpsString());
92 trackState.setAlbum(trackState.album()); 110 trackState.setAlbum(trackState.album()); ////updating property editor
93 actGroupAudios->setEnabled(true); 111 actGroupAudios->setEnabled(true);
112
94} 113}
95 114
96void QWpsEditorWindow::logMsg(QString s) { 115void QWpsEditorWindow::logMsg(QString s) {
@@ -108,7 +127,9 @@ void QWpsEditorWindow::slotUpdatePlainWps() {
108 DEBUGF1(tr("Updating WPS")); 127 DEBUGF1(tr("Updating WPS"));
109 plainWpsEdit->document()->setModified(false); 128 plainWpsEdit->document()->setModified(false);
110 drawer->WpsInit(plainWpsEdit->toPlainText(),false); 129 drawer->WpsInit(plainWpsEdit->toPlainText(),false);
111 130 m_propertyEditor->setEnabled(true);
131 actGroupAudios->setEnabled(true);
132 trackState.setAlbum(trackState.album()); //updating property editor
112} 133}
113 134
114void QWpsEditorWindow::slotPlainDocModChanged(bool changed) { 135void QWpsEditorWindow::slotPlainDocModChanged(bool changed) {
@@ -117,4 +138,15 @@ void QWpsEditorWindow::slotPlainDocModChanged(bool changed) {
117 else 138 else
118 dockPlainWps->setWindowTitle(tr("PlainWps")); 139 dockPlainWps->setWindowTitle(tr("PlainWps"));
119} 140}
141void QWpsEditorWindow::slotSetTarget(const QString & target) {
142 if (drawer->setTarget(target)) {
143 DEBUGF1(tr("New target <%1> switched").arg(target));
144 actTargets[target]->setChecked(true);
145 } else
146 DEBUGF1(tr("ERR: Target <%1> failed!").arg(target));
147 update();
148 slotUpdatePlainWps();
149}
150
151
120 152
diff --git a/utils/wpseditor/gui/src/qwpseditorwindow.h b/utils/wpseditor/gui/src/qwpseditorwindow.h
index 019eb63808..1becd74885 100644
--- a/utils/wpseditor/gui/src/qwpseditorwindow.h
+++ b/utils/wpseditor/gui/src/qwpseditorwindow.h
@@ -4,22 +4,29 @@
4#include <QMainWindow> 4#include <QMainWindow>
5#include <QActionGroup> 5#include <QActionGroup>
6#include <QSignalMapper> 6#include <QSignalMapper>
7
8#include "wpsstate.h"
7#include "ui_mainwindow.h" 9#include "ui_mainwindow.h"
8#include "wpsstate.h" 10#include "wpsstate.h"
9#include "qwpsdrawer.h"
10#include "qwpsstate.h" 11#include "qwpsstate.h"
11#include "qtrackstate.h" 12#include "qtrackstate.h"
12// 13#include "qwpsdrawer.h"
14
13class QWpsEditorWindow : public QMainWindow, public Ui::MainWindow { 15class QWpsEditorWindow : public QMainWindow, public Ui::MainWindow {
14 Q_OBJECT 16 Q_OBJECT
17
15 QWpsState wpsState; 18 QWpsState wpsState;
16 QTrackState trackState; 19 QTrackState trackState;
17 QPointer<QWpsDrawer> drawer; 20 QPointer<QWpsDrawer> drawer;
18 21
19 QHash<int, QAction*> actAudios; 22 QHash<int, QAction*> actAudios;
20 QActionGroup *actGroupAudios; 23 QActionGroup *actGroupAudios;
21 QSignalMapper *signalMapper; 24 QSignalMapper *audiosSignalMapper;
22 25
26 QHash<QString,QAction *> actTargets;
27 QActionGroup *actGroupTargets;
28 QSignalMapper *targetsSignalMapper;
29
23protected: 30protected:
24 void connectActions(); 31 void connectActions();
25public: 32public:
@@ -33,9 +40,11 @@ private slots:
33 40
34 void slotUpdatePlainWps(); 41 void slotUpdatePlainWps();
35 void slotPlainDocModChanged(bool m); 42 void slotPlainDocModChanged(bool m);
43 void slotSetTarget(const QString &);
36 44
37signals: 45signals:
38 void signalAudioStatusChanged(int); 46 void signalAudioStatusChanged(int);
47 void signalSetTarget(const QString &);
39 48
40}; 49};
41#endif 50#endif
@@ -43,3 +52,4 @@ signals:
43 52
44 53
45 54
55
diff --git a/utils/wpseditor/gui/src/slider.cpp b/utils/wpseditor/gui/src/slider.cpp
index 7e3c9a942c..4cbc714507 100644
--- a/utils/wpseditor/gui/src/slider.cpp
+++ b/utils/wpseditor/gui/src/slider.cpp
@@ -1,11 +1,11 @@
1#include "slider.h" 1#include "slider.h"
2#include <QDebug> 2#include <QDebug>
3// 3//
4Slider::Slider(QWidget *parent, QString caption, int min, int max ):QDialog(parent) { 4Slider::Slider(QWidget *parent, QString caption, int min, int max ):QDialog(parent),mCaption(caption) {
5 setupUi ( this ); 5 setupUi ( this );
6 connect(horslider, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int))); 6 connect(horslider, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int)));
7 connect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged(int))); 7 connect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged(int)));
8 setWindowTitle(caption); 8 setWindowTitle(mCaption);
9 horslider->setMinimum(min); 9 horslider->setMinimum(min);
10 horslider->setMaximum(max); 10 horslider->setMaximum(max);
11} 11}
@@ -14,7 +14,8 @@ int Slider::value() {
14 return horslider->value(); 14 return horslider->value();
15} 15}
16void Slider::slotValueChanged(int step) { 16void Slider::slotValueChanged(int step) {
17 setWindowTitle(tr("Value =%1 ").arg(step)); 17 setWindowTitle(tr("%1 = %2 ").arg(mCaption).arg(step));
18} 18}
19 19
20 20
21
diff --git a/utils/wpseditor/gui/src/slider.h b/utils/wpseditor/gui/src/slider.h
index 2620731644..8b8c1990d8 100644
--- a/utils/wpseditor/gui/src/slider.h
+++ b/utils/wpseditor/gui/src/slider.h
@@ -7,6 +7,7 @@
7// 7//
8class Slider : public QDialog , Ui::slider { 8class Slider : public QDialog , Ui::slider {
9 Q_OBJECT 9 Q_OBJECT
10 QString mCaption;
10public slots: 11public slots:
11 void slotValueChanged(int step); 12 void slotValueChanged(int step);
12signals: 13signals:
diff --git a/utils/wpseditor/gui/src/utils.cpp b/utils/wpseditor/gui/src/utils.cpp
index f18442555b..5b35f752a3 100644
--- a/utils/wpseditor/gui/src/utils.cpp
+++ b/utils/wpseditor/gui/src/utils.cpp
@@ -19,7 +19,6 @@ int qlogger(const char* fmt,...) {
19 s = "<font color=red>"+s+"</font>"; 19 s = "<font color=red>"+s+"</font>";
20 if (win!=0) 20 if (win!=0)
21 win->logMsg(s); 21 win->logMsg(s);
22 va_end(ap);
23 return s.length(); 22 return s.length();
24} 23}
25 24
diff --git a/utils/wpseditor/gui/src/utils.h b/utils/wpseditor/gui/src/utils.h
index ae88d78249..f1a05d3397 100644
--- a/utils/wpseditor/gui/src/utils.h
+++ b/utils/wpseditor/gui/src/utils.h
@@ -5,6 +5,7 @@
5 5
6#define DEBUGF1 qlogger 6#define DEBUGF1 qlogger
7#define DEBUGF2(...) 7#define DEBUGF2(...)
8#define DEBUGF3 qDebug
8 9
9extern int qlogger(const char* fmt,...); 10extern int qlogger(const char* fmt,...);
10extern int qlogger(const QString& s); 11extern int qlogger(const QString& s);
diff --git a/utils/wpseditor/gui/ui/mainwindow.ui b/utils/wpseditor/gui/ui/mainwindow.ui
index cd3f52bd66..f1186e4e7a 100644
--- a/utils/wpseditor/gui/ui/mainwindow.ui
+++ b/utils/wpseditor/gui/ui/mainwindow.ui
@@ -15,10 +15,10 @@
15 <widget class="QWidget" name="centralwidget" > 15 <widget class="QWidget" name="centralwidget" >
16 <property name="geometry" > 16 <property name="geometry" >
17 <rect> 17 <rect>
18 <x>260</x> 18 <x>262</x>
19 <y>21</y> 19 <y>19</y>
20 <width>344</width> 20 <width>340</width>
21 <height>345</height> 21 <height>346</height>
22 </rect> 22 </rect>
23 </property> 23 </property>
24 </widget> 24 </widget>
@@ -28,7 +28,7 @@
28 <x>0</x> 28 <x>0</x>
29 <y>0</y> 29 <y>0</y>
30 <width>882</width> 30 <width>882</width>
31 <height>21</height> 31 <height>19</height>
32 </rect> 32 </rect>
33 </property> 33 </property>
34 <widget class="QMenu" name="menuFile" > 34 <widget class="QMenu" name="menuFile" >
@@ -48,8 +48,14 @@
48 <string>Play</string> 48 <string>Play</string>
49 </property> 49 </property>
50 </widget> 50 </widget>
51 <widget class="QMenu" name="menuTarget" >
52 <property name="title" >
53 <string>Target</string>
54 </property>
55 </widget>
51 <addaction name="menuFile" /> 56 <addaction name="menuFile" />
52 <addaction name="menuPlay" /> 57 <addaction name="menuPlay" />
58 <addaction name="menuTarget" />
53 </widget> 59 </widget>
54 <widget class="QStatusBar" name="statusbar" > 60 <widget class="QStatusBar" name="statusbar" >
55 <property name="geometry" > 61 <property name="geometry" >
@@ -65,9 +71,9 @@
65 <property name="geometry" > 71 <property name="geometry" >
66 <rect> 72 <rect>
67 <x>0</x> 73 <x>0</x>
68 <y>370</y> 74 <y>371</y>
69 <width>882</width> 75 <width>882</width>
70 <height>280</height> 76 <height>279</height>
71 </rect> 77 </rect>
72 </property> 78 </property>
73 <property name="minimumSize" > 79 <property name="minimumSize" >
@@ -86,9 +92,9 @@
86 <property name="geometry" > 92 <property name="geometry" >
87 <rect> 93 <rect>
88 <x>0</x> 94 <x>0</x>
89 <y>22</y> 95 <y>20</y>
90 <width>882</width> 96 <width>882</width>
91 <height>258</height> 97 <height>259</height>
92 </rect> 98 </rect>
93 </property> 99 </property>
94 <layout class="QGridLayout" name="gridLayout_2" > 100 <layout class="QGridLayout" name="gridLayout_2" >
@@ -129,9 +135,9 @@
129 <property name="geometry" > 135 <property name="geometry" >
130 <rect> 136 <rect>
131 <x>0</x> 137 <x>0</x>
132 <y>21</y> 138 <y>19</y>
133 <width>256</width> 139 <width>256</width>
134 <height>345</height> 140 <height>346</height>
135 </rect> 141 </rect>
136 </property> 142 </property>
137 <property name="windowTitle" > 143 <property name="windowTitle" >
@@ -147,9 +153,9 @@
147 <property name="geometry" > 153 <property name="geometry" >
148 <rect> 154 <rect>
149 <x>0</x> 155 <x>0</x>
150 <y>22</y> 156 <y>20</y>
151 <width>256</width> 157 <width>256</width>
152 <height>323</height> 158 <height>326</height>
153 </rect> 159 </rect>
154 </property> 160 </property>
155 </widget> 161 </widget>
@@ -158,9 +164,9 @@
158 <property name="geometry" > 164 <property name="geometry" >
159 <rect> 165 <rect>
160 <x>608</x> 166 <x>608</x>
161 <y>21</y> 167 <y>19</y>
162 <width>274</width> 168 <width>274</width>
163 <height>345</height> 169 <height>346</height>
164 </rect> 170 </rect>
165 </property> 171 </property>
166 <property name="minimumSize" > 172 <property name="minimumSize" >
@@ -179,9 +185,9 @@
179 <property name="geometry" > 185 <property name="geometry" >
180 <rect> 186 <rect>
181 <x>0</x> 187 <x>0</x>
182 <y>22</y> 188 <y>20</y>
183 <width>274</width> 189 <width>274</width>
184 <height>323</height> 190 <height>326</height>
185 </rect> 191 </rect>
186 </property> 192 </property>
187 <layout class="QGridLayout" name="gridLayout" > 193 <layout class="QGridLayout" name="gridLayout" >
diff --git a/utils/wpseditor/libwps/Makefile b/utils/wpseditor/libwps/Makefile
index 3779a9ed30..c5d0a39de1 100644
--- a/utils/wpseditor/libwps/Makefile
+++ b/utils/wpseditor/libwps/Makefile
@@ -13,39 +13,40 @@ CC = gcc
13MKDIR = mkdir -p 13MKDIR = mkdir -p
14 14
15ifeq ($(findstring MINGW,$(shell uname)),MINGW) 15ifeq ($(findstring MINGW,$(shell uname)),MINGW)
16OS = w32 16 OS = w32
17CC = mingw32-gcc 17 CC = mingw32-gcc
18COPY = copy 18 COPY = copy
19RM = rm 19 RM = rm
20endif 20endif
21 21
22ifeq ($(findstring Linux,$(shell uname)),Linux) 22ifeq ($(findstring Linux,$(shell uname)),Linux)
23OS = linux 23 OS = linux
24CC = gcc 24 CC = gcc
25COPY = cp 25 COPY = cp
26RM = rm -f 26 RM = rm -f
27endif 27endif
28 28
29 29
30 30
31COMMON= \ 31SOURCES= \
32 src/dummies.c \
33 src/api.c \ 32 src/api.c \
33 src/dummies.c \
34 src/lcd.c \ 34 src/lcd.c \
35 src/proxy.c \
36 $(ROOT)/apps/gui/scrollbar.c \
37 $(ROOT)/apps/gui/gwps-common.c \
35 $(ROOT)/apps/gui/wps_parser.c \ 38 $(ROOT)/apps/gui/wps_parser.c \
36 $(ROOT)/apps/gui/wps_debug.c \ 39 $(ROOT)/apps/gui/wps_debug.c \
37 $(ROOT)/firmware/font.c \
38 $(ROOT)/apps/misc.c \
39 $(ROOT)/apps/gui/gwps-common.c \
40 $(ROOT)/apps/status.c \
41 $(ROOT)/apps/recorder/peakmeter.c \ 40 $(ROOT)/apps/recorder/peakmeter.c \
42 $(ROOT)/apps/recorder/icons.c \ 41 $(ROOT)/apps/recorder/icons.c \
43 $(ROOT)/apps/gui/scrollbar.c \ 42 $(ROOT)/apps/misc.c \
43 $(ROOT)/apps/status.c \
44 $(ROOT)/firmware/common/ctype.c \
44 $(ROOT)/firmware/common/timefuncs.c \ 45 $(ROOT)/firmware/common/timefuncs.c \
45 $(ROOT)/firmware/common/unicode.c \ 46 $(ROOT)/firmware/common/unicode.c \
46 $(ROOT)/firmware/common/ctype.c \ 47 $(ROOT)/firmware/font.c \
47 $(ROOT)/firmware/id3.c \
48 $(ROOT)/firmware/font_cache.c \ 48 $(ROOT)/firmware/font_cache.c \
49 $(ROOT)/firmware/id3.c \
49 $(ROOT)/firmware/lru.c \ 50 $(ROOT)/firmware/lru.c \
50 $(ROOT)/firmware/mp3data.c \ 51 $(ROOT)/firmware/mp3data.c \
51 $(ROOT)/firmware/replaygain.c 52 $(ROOT)/firmware/replaygain.c
@@ -72,13 +73,13 @@ all:
72 73
73build: build-$(OS) 74build: build-$(OS)
74 75
75build-w32: src/proxy.c $(COMMON) 76build-w32: $(SOURCES)
76 @echo CC [$(TARGET)] 77 @echo CC [$(TARGET)]
77 @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -DBUILD_DLL $(COMMON) -shared src/proxy.c -o libwps_$(MODEL).dll 78 @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -DBUILD_DLL $(SOURCES) -shared -o libwps_$(MODEL).dll
78 79
79build-linux: src/proxy.c $(COMMON) 80build-linux: $(SOURCES)
80 @echo CC [$(TARGET)] 81 @echo CC [$(TARGET)]
81 @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -shared -Wl,-soname,libwps_$(MODEL).so,-olibwps_$(MODEL).so -fPIC $(COMMON) src/proxy.c 82 @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -shared -Wl,-soname,libwps_$(MODEL).so,-olibwps_$(MODEL).so -fPIC $(SOURCES)
82 83
83clean: clean-$(OS) 84clean: clean-$(OS)
84 85
@@ -86,15 +87,15 @@ clean-w32:
86 $(RM) "libwps_$(MODEL).dll" 87 $(RM) "libwps_$(MODEL).dll"
87 88
88clean-linux: 89clean-linux:
89 $(RM) "libwps_$(MODEL).so.1" 90 $(RM) "libwps_$(MODEL).so"
90 91
91shared: shared-$(OS) 92shared: shared-$(OS)
92 93
93shared-w32: src/proxy.c $(COMMON) 94shared-w32: $(SOURCES)
94 @echo CC [IRIVER_H10_5GB] 95 @echo CC [IRIVER_H10_5GB]
95 @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -DBUILD_DLL $(COMMON) -shared src/proxy.c -o ../gui/bin/libwps.dll 96 @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -DBUILD_DLL -shared $(SOURCES) -o ../gui/bin/libwps_h10_5gb.dll
96 97
97shared-linux: src/proxy.c $(COMMON) 98shared-linux: $(SOURCES)
98 @echo CC [IRIVER_H10_5GB] 99 @echo CC [IRIVER_H10_5GB]
99 @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -shared -Wl,-soname,libwps.so,-olibwps.so -fPIC $(COMMON) src/proxy.c 100 @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -shared -Wl,-soname,libwps_h10_5gb.so,-olibwps_h10_5gb.so -fPIC $(SOURCES)
100 @$(COPY) libwps.so ../gui/bin/libwps.so 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
new file mode 100644
index 0000000000..c545453934
--- /dev/null
+++ b/utils/wpseditor/libwps/buildall.bat
@@ -0,0 +1,4 @@
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
index 60677d22b6..0f32bb9b9a 100644..100755
--- a/utils/wpseditor/libwps/buildall.sh
+++ b/utils/wpseditor/libwps/buildall.sh
@@ -4,4 +4,6 @@ cat targets.txt | (
4 do 4 do
5 make MODEL=$model TARGET=$target build 5 make MODEL=$model TARGET=$target build
6 done 6 done
7 cp *.dll ../gui/bin
8 cp *.so ../gui/bin
7) 9)
diff --git a/utils/wpseditor/libwps/src/api.c b/utils/wpseditor/libwps/src/api.c
index 485efa8e00..89538423b4 100644
--- a/utils/wpseditor/libwps/src/api.c
+++ b/utils/wpseditor/libwps/src/api.c
@@ -32,8 +32,7 @@ bool load_remote_wps_backdrop(char* filename) {
32} 32}
33 33
34int read_bmp_file(const char* filename,struct bitmap *bm, int maxsize,int format) { 34int read_bmp_file(const char* filename,struct bitmap *bm, int maxsize,int format) {
35 if (!xapi->read_bmp_file) 35 if (!xapi->read_bmp_file) {
36 {
37 DEBUGF1("can't read bmp file! NULL api!\n"); 36 DEBUGF1("can't read bmp file! NULL api!\n");
38 return -1; 37 return -1;
39 } 38 }
@@ -84,7 +83,7 @@ int getstringsize(const unsigned char *str, int *w, int *h) {
84 return 1; 83 return 1;
85} 84}
86 85
87void set_wpsstate(struct wpsstate state){ 86void set_wpsstate(struct wpsstate state) {
88 sysfont.height = state.fontheight; 87 sysfont.height = state.fontheight;
89 sysfont.maxwidth = state.fontwidth; 88 sysfont.maxwidth = state.fontwidth;
90 global_settings.volume = state.volume; 89 global_settings.volume = state.volume;
@@ -92,7 +91,10 @@ void set_wpsstate(struct wpsstate state){
92 _audio_status = state.audio_status; 91 _audio_status = state.audio_status;
93} 92}
94 93
95void set_trackstate(struct trackstate state){ 94void set_trackstate(struct trackstate state) {
95 if (!(gui_wps[0].state) ||
96 !(gui_wps[0].state->id3))
97 return;
96 gui_wps[0].state->id3->title = state.title; 98 gui_wps[0].state->id3->title = state.title;
97 gui_wps[0].state->id3->artist = state.artist; 99 gui_wps[0].state->id3->artist = state.artist;
98 gui_wps[0].state->id3->album = state.album; 100 gui_wps[0].state->id3->album = state.album;
@@ -100,8 +102,7 @@ void set_trackstate(struct trackstate state){
100 gui_wps[0].state->id3->length = state.length; 102 gui_wps[0].state->id3->length = state.length;
101} 103}
102 104
103void set_next_trackstate(struct trackstate state) 105void set_next_trackstate(struct trackstate state) {
104{
105 gui_wps[0].state->nid3->title = state.title; 106 gui_wps[0].state->nid3->title = state.title;
106 gui_wps[0].state->nid3->artist = state.artist; 107 gui_wps[0].state->nid3->artist = state.artist;
107 gui_wps[0].state->nid3->album = state.album; 108 gui_wps[0].state->nid3->album = state.album;
@@ -110,21 +111,21 @@ void set_next_trackstate(struct trackstate state)
110} 111}
111 112
112enum api_playmode playmodes[PLAYMODES_NUM] = { 113enum api_playmode playmodes[PLAYMODES_NUM] = {
113 API_STATUS_PLAY, 114 API_STATUS_PLAY,
114 API_STATUS_STOP, 115 API_STATUS_STOP,
115 API_STATUS_PAUSE, 116 API_STATUS_PAUSE,
116 API_STATUS_FASTFORWARD, 117 API_STATUS_FASTFORWARD,
117 API_STATUS_FASTBACKWARD 118 API_STATUS_FASTBACKWARD
118}; 119 };
119 120
120const char *playmodeNames[] = { 121const char *playmodeNames[] = {
121 "Play", "Stop", "Pause", "FastForward", "FastBackward" 122 "Play", "Stop", "Pause", "FastForward", "FastBackward"
122}; 123 };
123 124
124 125
125void set_audio_status(int status){ 126void set_audio_status(int status) {
126 DEBUGF1("%s",playmodeNames[status]); 127 DEBUGF1("%s",playmodeNames[status]);
127 switch(status){ 128 switch (status) {
128 case API_STATUS_PLAY: 129 case API_STATUS_PLAY:
129 _audio_status = AUDIO_STATUS_PLAY; 130 _audio_status = AUDIO_STATUS_PLAY;
130 status_set_ffmode(STATUS_PLAY); 131 status_set_ffmode(STATUS_PLAY);
@@ -203,8 +204,6 @@ int set_api(struct proxy_api* api) {
203#else 204#else
204 screens[0].is_color=false; 205 screens[0].is_color=false;
205#endif 206#endif
206 if (api->getwidth)
207 screens[0].getwidth = api->getwidth;
208 if (api->stop_scroll) 207 if (api->stop_scroll)
209 screens[0].stop_scroll=api->stop_scroll; 208 screens[0].stop_scroll=api->stop_scroll;
210 screens[0].scroll_stop = lcd_scroll_stop; 209 screens[0].scroll_stop = lcd_scroll_stop;
@@ -266,3 +265,4 @@ int set_api(struct proxy_api* api) {
266 265
267 266
268 267
268
diff --git a/utils/wpseditor/libwps/src/proxy.c b/utils/wpseditor/libwps/src/proxy.c
index 3a3b8ce4d9..8f9218e3ff 100644
--- a/utils/wpseditor/libwps/src/proxy.c
+++ b/utils/wpseditor/libwps/src/proxy.c
@@ -69,7 +69,7 @@ void* plugin_get_buffer(size_t *buffer_size)
69int checkwps(const char *filename, int verbose){ 69int checkwps(const char *filename, int verbose){
70 int res; 70 int res;
71 int fd; 71 int fd;
72 72
73 struct wps_data wps; 73 struct wps_data wps;
74 wps_verbose_level = verbose; 74 wps_verbose_level = verbose;
75 75
@@ -104,9 +104,8 @@ int wps_init(const char* filename,struct proxy_api *api, bool isfile){
104 if (!res) 104 if (!res)
105 { 105 {
106 DEBUGF1("ERR: WPS parsing failure\n"); 106 DEBUGF1("ERR: WPS parsing failure\n");
107 return 3; 107 } else
108 } 108 DEBUGF1("WPS parsed OK\n");
109 DEBUGF1("WPS parsed OK\n");
110 DEBUGF1("\n-------------------------------------------------\n"); 109 DEBUGF1("\n-------------------------------------------------\n");
111 wps_state.paused = true; 110 wps_state.paused = true;
112 gwps.data = &wpsdata; 111 gwps.data = &wpsdata;
@@ -115,7 +114,7 @@ int wps_init(const char* filename,struct proxy_api *api, bool isfile){
115 gwps.state->id3 = &id3; 114 gwps.state->id3 = &id3;
116 gwps.state->nid3 = &nid3; 115 gwps.state->nid3 = &nid3;
117 gui_wps[0] = gwps; 116 gui_wps[0] = gwps;
118 return res; 117 return (res?res:3);
119} 118}
120 119
121int wps_display(){ 120int wps_display(){
diff --git a/utils/wpseditor/libwps/src/proxy.h b/utils/wpseditor/libwps/src/proxy.h
index 3836ecc6d0..df0abd3c3e 100644
--- a/utils/wpseditor/libwps/src/proxy.h
+++ b/utils/wpseditor/libwps/src/proxy.h
@@ -1,6 +1,8 @@
1#ifndef PROXY_H 1#ifndef PROXY_H
2#define PROXY_h 2#define PROXY_h
3 3
4#include <stdio.h>
5
4#include "screen_access.h" 6#include "screen_access.h"
5#include "api.h" 7#include "api.h"
6#include "defs.h" 8#include "defs.h"
@@ -9,13 +11,13 @@
9#define DEBUGF1 dbgf 11#define DEBUGF1 dbgf
10#define DEBUGF2(...) 12#define DEBUGF2(...)
11#define DEBUGF3(...) 13#define DEBUGF3(...)
14#define DEBUGF4(...)
12 15
13EXPORT int checkwps(const char *filename, int verbose); 16EXPORT int checkwps(const char *filename, int verbose);
14EXPORT int wps_init(const char* filename,struct proxy_api *api,bool isfile); 17EXPORT int wps_init(const char* filename,struct proxy_api *api,bool isfile);
15EXPORT int wps_display(); 18EXPORT int wps_display();
16EXPORT int wps_refresh(); 19EXPORT int wps_refresh();
17 20EXPORT const char* get_model_name();
18const char* get_model_name();
19 21
20extern struct screen screens[NB_SCREENS]; 22extern struct screen screens[NB_SCREENS];
21extern bool debug_wps; 23extern bool debug_wps;
diff --git a/utils/wpseditor/libwps/targets.txt b/utils/wpseditor/libwps/targets.txt
index d2c54378d9..547a2ba42c 100644
--- a/utils/wpseditor/libwps/targets.txt
+++ b/utils/wpseditor/libwps/targets.txt
@@ -1,33 +1,9 @@
1ARCHOS_RECORDER recorder
2ARCHOS_FMRECORDER fmrecorder
3ARCHOS_RECORDERV2 recorderv2
4ARCHOS_ONDIOSP ondiosp
5ARCHOS_ONDIOFM ondiofm
6IRIVER_H120 h120
7IRIVER_H300 h300
8IRIVER_H100 h100
9IRIVER_IFP7XX ifp7xx
10IRIVER_H10 h10 1IRIVER_H10 h10
11IRIVER_H10_5GB h10_5gb 2IRIVER_H10_5GB h10_5gb
12IPOD_COLOR ipodcolor 3IPOD_COLOR ipodcolor
13IPOD_NANO ipodnano 4IPOD_NANO ipodnano
14IPOD_VIDEO ipodvideo 5IPOD_VIDEO ipodvideo
15IPOD_3G ipod3g
16IPOD_4G ipod4g
17IPOD_MINI ipodmini
18IPOD_MINI2G ipodmini2g
19IPOD_1G2G ipod1g2g
20IAUDIO_X5 x5
21IAUDIO_M5 m5
22COWON_D2 cowond2
23IAUDIO_M3 m3
24GIGABEAT_F gigabeatf 6GIGABEAT_F gigabeatf
25GIGABEAT_S gigabeats 7GIGABEAT_S gigabeats
26MROBE_500 mrobe500
27MROBE_100 mrobe100
28LOGIK_DAX logikdax
29CREATIVE_ZVM creativezvm
30SANSA_E200 e200 8SANSA_E200 e200
31SANSA_E200 e200r
32SANSA_C200 c200 9SANSA_C200 c200
33ELIO_TPJ1022 tpj1022