diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2008-09-10 19:41:18 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2008-09-10 19:41:18 +0000 |
commit | f414c6e19f743412aea40611da447f073fabeea8 (patch) | |
tree | 998e2c23862400efb85fe6e693e883e272fc7c45 | |
parent | 1ff9ce202dd1868ab1fd5dda727117500e30d82b (diff) | |
download | rockbox-f414c6e19f743412aea40611da447f073fabeea8.tar.gz rockbox-f414c6e19f743412aea40611da447f073fabeea8.zip |
WpsEditor: add linenumbrs WpsEditor: Add linenumbers to the WPS Code, and highlight the error line, if parsing fails. (FS#9362)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18483 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | utils/wpseditor/gui/gui.pro | 12 | ||||
-rw-r--r-- | utils/wpseditor/gui/src/numberedtextview.cpp | 181 | ||||
-rw-r--r-- | utils/wpseditor/gui/src/numberedtextview.h | 87 | ||||
-rw-r--r-- | utils/wpseditor/gui/src/qwpseditorwindow.cpp | 48 | ||||
-rw-r--r-- | utils/wpseditor/gui/src/qwpseditorwindow.h | 7 | ||||
-rw-r--r-- | utils/wpseditor/gui/ui/mainwindow.ui | 104 |
6 files changed, 339 insertions, 100 deletions
diff --git a/utils/wpseditor/gui/gui.pro b/utils/wpseditor/gui/gui.pro index ada7ea3c98..088ab04119 100644 --- a/utils/wpseditor/gui/gui.pro +++ b/utils/wpseditor/gui/gui.pro | |||
@@ -1,7 +1,7 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | TARGET = | 2 | TARGET = |
3 | DEPENDPATH += . build src ui | 3 | DEPENDPATH += . build src ui |
4 | INCLUDEPATH += . src/QPropertyEditor ../libwps/src | 4 | INCLUDEPATH += . src src/QPropertyEditor ../libwps/src |
5 | DESTDIR = bin | 5 | DESTDIR = bin |
6 | OBJECTS_DIR = build | 6 | OBJECTS_DIR = build |
7 | MOC_DIR = build | 7 | MOC_DIR = build |
@@ -17,7 +17,9 @@ HEADERS += ../libwps/src/api.h \ | |||
17 | src/qwpseditorwindow.h \ | 17 | src/qwpseditorwindow.h \ |
18 | src/utils.h \ | 18 | src/utils.h \ |
19 | src/qwpsdrawer.h \ | 19 | src/qwpsdrawer.h \ |
20 | src/qsyntaxer.h | 20 | src/qsyntaxer.h \ |
21 | src/numberedtextview.h | ||
22 | |||
21 | FORMS += ui/mainwindow.ui ui/slider.ui | 23 | FORMS += ui/mainwindow.ui ui/slider.ui |
22 | SOURCES += src/main.cpp \ | 24 | SOURCES += src/main.cpp \ |
23 | src/slider.cpp \ | 25 | src/slider.cpp \ |
@@ -27,8 +29,10 @@ SOURCES += src/main.cpp \ | |||
27 | src/utils.cpp \ | 29 | src/utils.cpp \ |
28 | src/qwpsdrawer.cpp \ | 30 | src/qwpsdrawer.cpp \ |
29 | src/qwpsdrawer_static.cpp \ | 31 | src/qwpsdrawer_static.cpp \ |
30 | src/qsyntaxer.cpp | 32 | src/qsyntaxer.cpp \ |
31 | LIBS += -Lbin | 33 | src/numberedtextview.cpp |
34 | |||
35 | LIBS += -Lbin | ||
32 | CONFIG(debug, debug|release) { | 36 | CONFIG(debug, debug|release) { |
33 | LIBS += -lQPropertyEditord | 37 | LIBS += -lQPropertyEditord |
34 | TARGET = wpseditord | 38 | TARGET = wpseditord |
diff --git a/utils/wpseditor/gui/src/numberedtextview.cpp b/utils/wpseditor/gui/src/numberedtextview.cpp new file mode 100644 index 0000000000..81c4208b59 --- /dev/null +++ b/utils/wpseditor/gui/src/numberedtextview.cpp | |||
@@ -0,0 +1,181 @@ | |||
1 | /* This file is part of the KDE libraries | ||
2 | Copyright (C) 2005, 2006 KJSEmbed Authors | ||
3 | See included AUTHORS file. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Library General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2 of the License, or (at your option) any later version. | ||
9 | |||
10 | This 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 License | ||
16 | along with this library; see the file COPYING.LIB. If not, write to | ||
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | |||
20 | |||
21 | -------------------------------------------------------------------------------------- | ||
22 | Imported into the WPS editor and simplified by Dominik Wenger | ||
23 | |||
24 | */ | ||
25 | |||
26 | |||
27 | #include <QTextDocument> | ||
28 | #include <QTextBlock> | ||
29 | #include <QTextEdit> | ||
30 | #include <QHBoxLayout> | ||
31 | #include <QScrollBar> | ||
32 | #include <QPainter> | ||
33 | #include <QAbstractTextDocumentLayout> | ||
34 | #include <QDebug> | ||
35 | |||
36 | #include "numberedtextview.h" | ||
37 | |||
38 | NumberBar::NumberBar( QWidget *parent ) | ||
39 | : QWidget( parent ), edit(0), markedLine(-1) | ||
40 | { | ||
41 | // Make room for 4 digits and the breakpoint icon | ||
42 | setFixedWidth( fontMetrics().width( QString("0000") + 10 + 32 ) ); | ||
43 | markerIcon = QPixmap( "images/marker.png" ); | ||
44 | } | ||
45 | |||
46 | NumberBar::~NumberBar() | ||
47 | { | ||
48 | } | ||
49 | |||
50 | |||
51 | void NumberBar::markLine( int lineno ) | ||
52 | { | ||
53 | markedLine = lineno; | ||
54 | } | ||
55 | |||
56 | void NumberBar::setTextEdit( QTextEdit *edit ) | ||
57 | { | ||
58 | this->edit = edit; | ||
59 | connect( edit->document()->documentLayout(), SIGNAL( update(const QRectF &) ), | ||
60 | this, SLOT( update() ) ); | ||
61 | connect( edit->verticalScrollBar(), SIGNAL(valueChanged(int) ), | ||
62 | this, SLOT( update() ) ); | ||
63 | } | ||
64 | |||
65 | void NumberBar::paintEvent( QPaintEvent * ) | ||
66 | { | ||
67 | QAbstractTextDocumentLayout *layout = edit->document()->documentLayout(); | ||
68 | int contentsY = edit->verticalScrollBar()->value(); | ||
69 | qreal pageBottom = contentsY + edit->viewport()->height(); | ||
70 | const QFontMetrics fm = fontMetrics(); | ||
71 | const int ascent = fontMetrics().ascent() + 1; // height = ascent + descent + 1 | ||
72 | int lineCount = 1; | ||
73 | |||
74 | QPainter p(this); | ||
75 | |||
76 | markedRect = QRect(); | ||
77 | |||
78 | for ( QTextBlock block = edit->document()->begin(); | ||
79 | block.isValid(); block = block.next(), ++lineCount ) | ||
80 | { | ||
81 | |||
82 | const QRectF boundingRect = layout->blockBoundingRect( block ); | ||
83 | |||
84 | QPointF position = boundingRect.topLeft(); | ||
85 | if ( position.y() + boundingRect.height() < contentsY ) | ||
86 | continue; | ||
87 | if ( position.y() > pageBottom ) | ||
88 | break; | ||
89 | |||
90 | const QString txt = QString::number( lineCount ); | ||
91 | p.drawText( width() - fm.width(txt), qRound( position.y() ) - contentsY + ascent, txt ); | ||
92 | |||
93 | // marker | ||
94 | if ( markedLine == lineCount ) | ||
95 | { | ||
96 | p.drawPixmap( 1, qRound( position.y() ) - contentsY, markerIcon ); | ||
97 | markedRect = QRect( 1, qRound( position.y() ) - contentsY, markerIcon.width(), markerIcon.height() ); | ||
98 | } | ||
99 | } | ||
100 | } | ||
101 | |||
102 | NumberedTextView::NumberedTextView( QWidget *parent ) | ||
103 | : QFrame( parent ) | ||
104 | { | ||
105 | setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); | ||
106 | setLineWidth( 2 ); | ||
107 | |||
108 | // Setup the main view | ||
109 | view = new QTextEdit( this ); | ||
110 | //view->setFontFamily( "Courier" ); | ||
111 | view->setLineWrapMode( QTextEdit::NoWrap ); | ||
112 | view->setFrameStyle( QFrame::NoFrame ); | ||
113 | |||
114 | connect( view->document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(textChanged(int,int,int)) ); | ||
115 | |||
116 | // Setup the line number pane | ||
117 | numbers = new NumberBar( this ); | ||
118 | numbers->setTextEdit( view ); | ||
119 | |||
120 | // Test | ||
121 | markLine(2); | ||
122 | |||
123 | //setup layout | ||
124 | box = new QHBoxLayout( this ); | ||
125 | box->setSpacing( 0 ); | ||
126 | box->setMargin( 0 ); | ||
127 | box->addWidget( numbers ); | ||
128 | box->addWidget( view ); | ||
129 | } | ||
130 | |||
131 | NumberedTextView::~NumberedTextView() | ||
132 | { | ||
133 | } | ||
134 | |||
135 | void NumberedTextView::markLine( int lineno ) | ||
136 | { | ||
137 | markedLine = lineno; | ||
138 | numbers->markLine( lineno ); | ||
139 | textChanged(1,1,1); | ||
140 | } | ||
141 | |||
142 | void NumberedTextView::scrolltoLine( int lineno ) | ||
143 | { | ||
144 | int max = view->verticalScrollBar()->maximum(); | ||
145 | int min = view->verticalScrollBar()->minimum(); | ||
146 | int lines = view->document()->blockCount(); | ||
147 | view->verticalScrollBar()->setValue( (max*lineno)/lines+min ); | ||
148 | } | ||
149 | |||
150 | void NumberedTextView::textChanged( int pos, int removed, int added ) | ||
151 | { | ||
152 | Q_UNUSED( pos ); | ||
153 | |||
154 | if ( removed == 0 && added == 0 ) | ||
155 | return; | ||
156 | |||
157 | QTextBlock block = highlight.block(); | ||
158 | QTextBlockFormat fmt = block.blockFormat(); | ||
159 | QColor bg = view->palette().base().color(); | ||
160 | fmt.setBackground( bg ); | ||
161 | highlight.setBlockFormat( fmt ); | ||
162 | |||
163 | int lineCount = 1; | ||
164 | for ( QTextBlock block = view->document()->begin(); | ||
165 | block.isValid(); block = block.next(), ++lineCount ) | ||
166 | { | ||
167 | if ( lineCount == markedLine ) | ||
168 | { | ||
169 | fmt = block.blockFormat(); | ||
170 | QColor bg = Qt::red; | ||
171 | fmt.setBackground( bg.light(150) ); | ||
172 | |||
173 | highlight = QTextCursor( block ); | ||
174 | highlight.movePosition( QTextCursor::EndOfBlock, QTextCursor::KeepAnchor ); | ||
175 | highlight.setBlockFormat( fmt ); | ||
176 | |||
177 | break; | ||
178 | } | ||
179 | } | ||
180 | } | ||
181 | |||
diff --git a/utils/wpseditor/gui/src/numberedtextview.h b/utils/wpseditor/gui/src/numberedtextview.h new file mode 100644 index 0000000000..2a0d1de068 --- /dev/null +++ b/utils/wpseditor/gui/src/numberedtextview.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /* This file is part of the KDE libraries | ||
2 | Copyright (C) 2005, 2006 KJSEmbed Authors | ||
3 | See included AUTHORS file. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Library General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2 of the License, or (at your option) any later version. | ||
9 | |||
10 | This 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 License | ||
16 | along with this library; see the file COPYING.LIB. If not, write to | ||
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | |||
20 | -------------------------------------------------------------------------------------- | ||
21 | Imported into the WPS editor and simplified by Dominik Wenger | ||
22 | |||
23 | */ | ||
24 | |||
25 | |||
26 | #ifndef NUMBERED_TEXT_VIEW_H | ||
27 | #define NUMBERED_TEXT_VIEW_H | ||
28 | |||
29 | #include <QFrame> | ||
30 | #include <QPixmap> | ||
31 | #include <QTextCursor> | ||
32 | |||
33 | class QTextEdit; | ||
34 | class QHBoxLayout; | ||
35 | |||
36 | // Shows the Line numbers | ||
37 | class NumberBar : public QWidget | ||
38 | { | ||
39 | Q_OBJECT | ||
40 | |||
41 | public: | ||
42 | NumberBar( QWidget *parent ); | ||
43 | ~NumberBar(); | ||
44 | |||
45 | void markLine( int lineno ); | ||
46 | |||
47 | void setTextEdit( QTextEdit *edit ); | ||
48 | void paintEvent( QPaintEvent *ev ); | ||
49 | |||
50 | private: | ||
51 | QTextEdit *edit; | ||
52 | QPixmap markerIcon; | ||
53 | int markedLine; | ||
54 | QRect markedRect; | ||
55 | }; | ||
56 | |||
57 | // Shows a QTextEdit with Line numbers | ||
58 | class NumberedTextView : public QFrame | ||
59 | { | ||
60 | Q_OBJECT | ||
61 | |||
62 | public: | ||
63 | NumberedTextView( QWidget *parent = 0 ); | ||
64 | ~NumberedTextView(); | ||
65 | |||
66 | /** Returns the QTextEdit of the main view. */ | ||
67 | QTextEdit *textEdit() const { return view; } | ||
68 | |||
69 | /* marks the line with a icon */ | ||
70 | void markLine( int lineno ); | ||
71 | |||
72 | void scrolltoLine( int lineno ); | ||
73 | |||
74 | private slots: | ||
75 | void textChanged( int pos, int removed, int added ); | ||
76 | |||
77 | private: | ||
78 | QTextEdit *view; | ||
79 | NumberBar *numbers; | ||
80 | QHBoxLayout *box; | ||
81 | QTextCursor highlight; | ||
82 | int markedLine; | ||
83 | }; | ||
84 | |||
85 | |||
86 | #endif // NUMBERED_TEXT_VIEW_H | ||
87 | |||
diff --git a/utils/wpseditor/gui/src/qwpseditorwindow.cpp b/utils/wpseditor/gui/src/qwpseditorwindow.cpp index 29887c38bb..1527fef57a 100644 --- a/utils/wpseditor/gui/src/qwpseditorwindow.cpp +++ b/utils/wpseditor/gui/src/qwpseditorwindow.cpp | |||
@@ -47,6 +47,7 @@ const char *playmodeNames[] = { | |||
47 | QWpsEditorWindow::QWpsEditorWindow( QWidget * parent, Qt::WFlags f) | 47 | QWpsEditorWindow::QWpsEditorWindow( QWidget * parent, Qt::WFlags f) |
48 | : QMainWindow(parent, f) { | 48 | : QMainWindow(parent, f) { |
49 | logEdit = 0; | 49 | logEdit = 0; |
50 | scrollingLine = -1; | ||
50 | setupUi(this); | 51 | setupUi(this); |
51 | drawer = new QWpsDrawer(&wpsState,&trackState, this); | 52 | drawer = new QWpsDrawer(&wpsState,&trackState, this); |
52 | QWpsDrawer::api.verbose = 1; | 53 | QWpsDrawer::api.verbose = 1; |
@@ -54,7 +55,8 @@ QWpsEditorWindow::QWpsEditorWindow( QWidget * parent, Qt::WFlags f) | |||
54 | connectActions(); | 55 | connectActions(); |
55 | m_propertyEditor->addObject(&trackState); | 56 | m_propertyEditor->addObject(&trackState); |
56 | m_propertyEditor->addObject(&wpsState); | 57 | m_propertyEditor->addObject(&wpsState); |
57 | new QSyntaxer(plainWpsEdit->document()); | 58 | new QSyntaxer(plainWpsEdit->textEdit()->document()); |
59 | plainWpsEdit->markLine(-1); | ||
58 | } | 60 | } |
59 | 61 | ||
60 | void QWpsEditorWindow::connectActions() { | 62 | void QWpsEditorWindow::connectActions() { |
@@ -65,7 +67,7 @@ void QWpsEditorWindow::connectActions() { | |||
65 | connect(actShowGrid, SIGNAL(triggered(bool)), drawer, SLOT(slotShowGrid(bool))); | 67 | connect(actShowGrid, SIGNAL(triggered(bool)), drawer, SLOT(slotShowGrid(bool))); |
66 | 68 | ||
67 | connect(actUpdatePlainWps, SIGNAL(triggered()), SLOT(slotUpdatePlainWps())); | 69 | connect(actUpdatePlainWps, SIGNAL(triggered()), SLOT(slotUpdatePlainWps())); |
68 | connect(plainWpsEdit->document(),SIGNAL(modificationChanged(bool)),SLOT(slotPlainDocModChanged(bool))); | 70 | connect(plainWpsEdit->textEdit()->document(),SIGNAL(modificationChanged(bool)),SLOT(slotPlainDocModChanged(bool))); |
69 | 71 | ||
70 | connect(&wpsState, SIGNAL(stateChanged(wpsstate)), drawer, SLOT(slotWpsStateChanged(wpsstate))); | 72 | connect(&wpsState, SIGNAL(stateChanged(wpsstate)), drawer, SLOT(slotWpsStateChanged(wpsstate))); |
71 | connect(&trackState, SIGNAL(stateChanged(trackstate)), drawer, SLOT(slotTrackStateChanged(trackstate))); | 73 | connect(&trackState, SIGNAL(stateChanged(trackstate)), drawer, SLOT(slotTrackStateChanged(trackstate))); |
@@ -124,17 +126,23 @@ void QWpsEditorWindow::slotOpenWps() { | |||
124 | DEBUGF1(tr("File wasn't chosen")); | 126 | DEBUGF1(tr("File wasn't chosen")); |
125 | return; | 127 | return; |
126 | } | 128 | } |
127 | m_propertyEditor->setEnabled(true); | 129 | scrollingLine = -1; |
128 | drawer->WpsInit(wpsfile); | 130 | drawer->WpsInit(wpsfile); |
129 | plainWpsEdit->clear(); | 131 | plainWpsEdit->textEdit()->clear(); |
130 | plainWpsEdit->append(drawer->wpsString()); | 132 | plainWpsEdit->textEdit()->append(drawer->wpsString()); |
131 | trackState.setAlbum(trackState.album()); ////updating property editor | 133 | postWpsUpdate(); |
132 | actGroupAudios->setEnabled(true); | ||
133 | |||
134 | } | 134 | } |
135 | 135 | ||
136 | void QWpsEditorWindow::logMsg(QString s) { | 136 | void QWpsEditorWindow::logMsg(QString s) { |
137 | logEdit->append(s); | 137 | logEdit->append(s); |
138 | // check for error line: | ||
139 | if (s.contains("ERR: Failed parsing on line ")) { | ||
140 | QRegExp error("\\d+"); | ||
141 | if (error.indexIn(s) != -1) { | ||
142 | scrollingLine = error.cap(0).toInt(); | ||
143 | plainWpsEdit->markLine(scrollingLine); | ||
144 | } | ||
145 | } | ||
138 | } | 146 | } |
139 | 147 | ||
140 | void QWpsEditorWindow::slotVerboseLevel() { | 148 | void QWpsEditorWindow::slotVerboseLevel() { |
@@ -146,18 +154,18 @@ void QWpsEditorWindow::slotVerboseLevel() { | |||
146 | 154 | ||
147 | void QWpsEditorWindow::slotUpdatePlainWps() { | 155 | void QWpsEditorWindow::slotUpdatePlainWps() { |
148 | DEBUGF1(tr("Updating WPS")); | 156 | DEBUGF1(tr("Updating WPS")); |
149 | plainWpsEdit->document()->setModified(false); | 157 | scrollingLine = -1; |
150 | drawer->WpsInit(plainWpsEdit->toPlainText(),false); | 158 | drawer->WpsInit(plainWpsEdit->textEdit()->toPlainText(),false); |
151 | m_propertyEditor->setEnabled(true); | 159 | postWpsUpdate(); |
152 | actGroupAudios->setEnabled(true); | ||
153 | trackState.setAlbum(trackState.album()); //updating property editor | ||
154 | } | 160 | } |
155 | 161 | ||
156 | void QWpsEditorWindow::slotPlainDocModChanged(bool changed) { | 162 | void QWpsEditorWindow::slotPlainDocModChanged(bool changed) { |
157 | if (changed) | 163 | if (changed) { |
158 | dockPlainWps->setWindowTitle(tr("PlainWps*")); | 164 | dockPlainWps->setWindowTitle(tr("PlainWps*")); |
159 | else | 165 | plainWpsEdit->markLine(-1); |
166 | } else { | ||
160 | dockPlainWps->setWindowTitle(tr("PlainWps")); | 167 | dockPlainWps->setWindowTitle(tr("PlainWps")); |
168 | } | ||
161 | } | 169 | } |
162 | void QWpsEditorWindow::slotSetTarget(const QString & target) { | 170 | void QWpsEditorWindow::slotSetTarget(const QString & target) { |
163 | if (drawer->setTarget(target)) { | 171 | if (drawer->setTarget(target)) { |
@@ -169,5 +177,15 @@ void QWpsEditorWindow::slotSetTarget(const QString & target) { | |||
169 | slotUpdatePlainWps(); | 177 | slotUpdatePlainWps(); |
170 | } | 178 | } |
171 | 179 | ||
180 | void QWpsEditorWindow::postWpsUpdate() { | ||
181 | m_propertyEditor->setEnabled(true); | ||
182 | actGroupAudios->setEnabled(true); | ||
183 | trackState.setAlbum(trackState.album()); ////updating property editor | ||
184 | plainWpsEdit->markLine(scrollingLine); | ||
185 | plainWpsEdit->textEdit()->document()->setModified(false); | ||
186 | plainWpsEdit->scrolltoLine(scrollingLine); | ||
187 | scrollingLine = -1; | ||
188 | } | ||
189 | |||
172 | 190 | ||
173 | 191 | ||
diff --git a/utils/wpseditor/gui/src/qwpseditorwindow.h b/utils/wpseditor/gui/src/qwpseditorwindow.h index 59670d8309..0009548be2 100644 --- a/utils/wpseditor/gui/src/qwpseditorwindow.h +++ b/utils/wpseditor/gui/src/qwpseditorwindow.h | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | class QWpsEditorWindow : public QMainWindow, public Ui::MainWindow { | 36 | class QWpsEditorWindow : public QMainWindow, public Ui::MainWindow { |
37 | Q_OBJECT | 37 | Q_OBJECT |
38 | 38 | ||
39 | QWpsState wpsState; | 39 | QWpsState wpsState; |
40 | QTrackState trackState; | 40 | QTrackState trackState; |
41 | QPointer<QWpsDrawer> drawer; | 41 | QPointer<QWpsDrawer> drawer; |
@@ -47,9 +47,11 @@ class QWpsEditorWindow : public QMainWindow, public Ui::MainWindow { | |||
47 | QHash<QString,QAction *> actTargets; | 47 | QHash<QString,QAction *> actTargets; |
48 | QActionGroup *actGroupTargets; | 48 | QActionGroup *actGroupTargets; |
49 | QSignalMapper *targetsSignalMapper; | 49 | QSignalMapper *targetsSignalMapper; |
50 | 50 | ||
51 | int scrollingLine; | ||
51 | protected: | 52 | protected: |
52 | void connectActions(); | 53 | void connectActions(); |
54 | void postWpsUpdate(); | ||
53 | public: | 55 | public: |
54 | QWpsEditorWindow( QWidget * parent = 0, Qt::WFlags f = 0 ); | 56 | QWpsEditorWindow( QWidget * parent = 0, Qt::WFlags f = 0 ); |
55 | void logMsg(QString s); | 57 | void logMsg(QString s); |
@@ -74,3 +76,4 @@ signals: | |||
74 | 76 | ||
75 | 77 | ||
76 | 78 | ||
79 | |||
diff --git a/utils/wpseditor/gui/ui/mainwindow.ui b/utils/wpseditor/gui/ui/mainwindow.ui index f1186e4e7a..a14eb832ad 100644 --- a/utils/wpseditor/gui/ui/mainwindow.ui +++ b/utils/wpseditor/gui/ui/mainwindow.ui | |||
@@ -12,23 +12,14 @@ | |||
12 | <property name="windowTitle" > | 12 | <property name="windowTitle" > |
13 | <string>WPS Editor</string> | 13 | <string>WPS Editor</string> |
14 | </property> | 14 | </property> |
15 | <widget class="QWidget" name="centralwidget" > | 15 | <widget class="QWidget" name="centralwidget" /> |
16 | <property name="geometry" > | ||
17 | <rect> | ||
18 | <x>262</x> | ||
19 | <y>19</y> | ||
20 | <width>340</width> | ||
21 | <height>346</height> | ||
22 | </rect> | ||
23 | </property> | ||
24 | </widget> | ||
25 | <widget class="QMenuBar" name="menubar" > | 16 | <widget class="QMenuBar" name="menubar" > |
26 | <property name="geometry" > | 17 | <property name="geometry" > |
27 | <rect> | 18 | <rect> |
28 | <x>0</x> | 19 | <x>0</x> |
29 | <y>0</y> | 20 | <y>0</y> |
30 | <width>882</width> | 21 | <width>882</width> |
31 | <height>19</height> | 22 | <height>21</height> |
32 | </rect> | 23 | </rect> |
33 | </property> | 24 | </property> |
34 | <widget class="QMenu" name="menuFile" > | 25 | <widget class="QMenu" name="menuFile" > |
@@ -57,25 +48,8 @@ | |||
57 | <addaction name="menuPlay" /> | 48 | <addaction name="menuPlay" /> |
58 | <addaction name="menuTarget" /> | 49 | <addaction name="menuTarget" /> |
59 | </widget> | 50 | </widget> |
60 | <widget class="QStatusBar" name="statusbar" > | 51 | <widget class="QStatusBar" name="statusbar" /> |
61 | <property name="geometry" > | ||
62 | <rect> | ||
63 | <x>0</x> | ||
64 | <y>650</y> | ||
65 | <width>882</width> | ||
66 | <height>19</height> | ||
67 | </rect> | ||
68 | </property> | ||
69 | </widget> | ||
70 | <widget class="QDockWidget" name="dockPlainWps" > | 52 | <widget class="QDockWidget" name="dockPlainWps" > |
71 | <property name="geometry" > | ||
72 | <rect> | ||
73 | <x>0</x> | ||
74 | <y>371</y> | ||
75 | <width>882</width> | ||
76 | <height>279</height> | ||
77 | </rect> | ||
78 | </property> | ||
79 | <property name="minimumSize" > | 53 | <property name="minimumSize" > |
80 | <size> | 54 | <size> |
81 | <width>0</width> | 55 | <width>0</width> |
@@ -89,25 +63,7 @@ | |||
89 | <number>8</number> | 63 | <number>8</number> |
90 | </attribute> | 64 | </attribute> |
91 | <widget class="QWidget" name="dockWidgetContents_3" > | 65 | <widget class="QWidget" name="dockWidgetContents_3" > |
92 | <property name="geometry" > | ||
93 | <rect> | ||
94 | <x>0</x> | ||
95 | <y>20</y> | ||
96 | <width>882</width> | ||
97 | <height>259</height> | ||
98 | </rect> | ||
99 | </property> | ||
100 | <layout class="QGridLayout" name="gridLayout_2" > | 66 | <layout class="QGridLayout" name="gridLayout_2" > |
101 | <item rowspan="2" row="0" column="0" > | ||
102 | <widget class="QTextEdit" name="plainWpsEdit" > | ||
103 | <property name="autoFillBackground" > | ||
104 | <bool>false</bool> | ||
105 | </property> | ||
106 | <property name="readOnly" > | ||
107 | <bool>false</bool> | ||
108 | </property> | ||
109 | </widget> | ||
110 | </item> | ||
111 | <item row="0" column="1" > | 67 | <item row="0" column="1" > |
112 | <widget class="QPushButton" name="btnUpdatePlainWps" > | 68 | <widget class="QPushButton" name="btnUpdatePlainWps" > |
113 | <property name="text" > | 69 | <property name="text" > |
@@ -128,18 +84,26 @@ | |||
128 | </property> | 84 | </property> |
129 | </spacer> | 85 | </spacer> |
130 | </item> | 86 | </item> |
87 | <item rowspan="2" row="0" column="0" > | ||
88 | <widget class="NumberedTextView" name="plainWpsEdit" > | ||
89 | <property name="sizePolicy" > | ||
90 | <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > | ||
91 | <horstretch>2</horstretch> | ||
92 | <verstretch>0</verstretch> | ||
93 | </sizepolicy> | ||
94 | </property> | ||
95 | <property name="frameShape" > | ||
96 | <enum>QFrame::StyledPanel</enum> | ||
97 | </property> | ||
98 | <property name="frameShadow" > | ||
99 | <enum>QFrame::Raised</enum> | ||
100 | </property> | ||
101 | </widget> | ||
102 | </item> | ||
131 | </layout> | 103 | </layout> |
132 | </widget> | 104 | </widget> |
133 | </widget> | 105 | </widget> |
134 | <widget class="QDockWidget" name="m_dockWidget" > | 106 | <widget class="QDockWidget" name="m_dockWidget" > |
135 | <property name="geometry" > | ||
136 | <rect> | ||
137 | <x>0</x> | ||
138 | <y>19</y> | ||
139 | <width>256</width> | ||
140 | <height>346</height> | ||
141 | </rect> | ||
142 | </property> | ||
143 | <property name="windowTitle" > | 107 | <property name="windowTitle" > |
144 | <string>Property Editor</string> | 108 | <string>Property Editor</string> |
145 | </property> | 109 | </property> |
@@ -150,25 +114,9 @@ | |||
150 | <property name="enabled" > | 114 | <property name="enabled" > |
151 | <bool>false</bool> | 115 | <bool>false</bool> |
152 | </property> | 116 | </property> |
153 | <property name="geometry" > | ||
154 | <rect> | ||
155 | <x>0</x> | ||
156 | <y>20</y> | ||
157 | <width>256</width> | ||
158 | <height>326</height> | ||
159 | </rect> | ||
160 | </property> | ||
161 | </widget> | 117 | </widget> |
162 | </widget> | 118 | </widget> |
163 | <widget class="QDockWidget" name="dockWidget" > | 119 | <widget class="QDockWidget" name="dockWidget" > |
164 | <property name="geometry" > | ||
165 | <rect> | ||
166 | <x>608</x> | ||
167 | <y>19</y> | ||
168 | <width>274</width> | ||
169 | <height>346</height> | ||
170 | </rect> | ||
171 | </property> | ||
172 | <property name="minimumSize" > | 120 | <property name="minimumSize" > |
173 | <size> | 121 | <size> |
174 | <width>0</width> | 122 | <width>0</width> |
@@ -182,14 +130,6 @@ | |||
182 | <number>2</number> | 130 | <number>2</number> |
183 | </attribute> | 131 | </attribute> |
184 | <widget class="QWidget" name="dockWidgetContents" > | 132 | <widget class="QWidget" name="dockWidgetContents" > |
185 | <property name="geometry" > | ||
186 | <rect> | ||
187 | <x>0</x> | ||
188 | <y>20</y> | ||
189 | <width>274</width> | ||
190 | <height>326</height> | ||
191 | </rect> | ||
192 | </property> | ||
193 | <layout class="QGridLayout" name="gridLayout" > | 133 | <layout class="QGridLayout" name="gridLayout" > |
194 | <item row="0" column="0" > | 134 | <item row="0" column="0" > |
195 | <widget class="QTextEdit" name="logEdit" > | 135 | <widget class="QTextEdit" name="logEdit" > |
@@ -257,6 +197,12 @@ | |||
257 | <extends>QTreeView</extends> | 197 | <extends>QTreeView</extends> |
258 | <header>QPropertyEditorWidget.h</header> | 198 | <header>QPropertyEditorWidget.h</header> |
259 | </customwidget> | 199 | </customwidget> |
200 | <customwidget> | ||
201 | <class>NumberedTextView</class> | ||
202 | <extends>QFrame</extends> | ||
203 | <header>numberedtextview.h</header> | ||
204 | <container>1</container> | ||
205 | </customwidget> | ||
260 | </customwidgets> | 206 | </customwidgets> |
261 | <resources/> | 207 | <resources/> |
262 | <connections> | 208 | <connections> |