Changeset 330
- Timestamp:
- 06/06/08 09:48:42 (3 months ago)
- Files:
-
- projects/MyPoint/src/page.cpp (modified) (2 diffs)
- projects/MyPoint/src/page.h (modified) (2 diffs)
- projects/MyPoint/src/pdfslidereporter.cpp (modified) (7 diffs)
- projects/MyPoint/src/pdfslidereporter.h (modified) (2 diffs)
- projects/MyPoint/src/simpleparser.cpp (modified) (1 diff)
- projects/MyPoint/src/src.pro (modified) (2 diffs)
- projects/MyPoint/src/wikirpc.cpp (modified) (1 diff)
- projects/MyPoint/src/wikirpc.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
projects/MyPoint/src/page.cpp
r324 r330 100 100 m_preText.clear(); 101 101 m_background.clear(); 102 m_table.clear(); 102 103 } 103 104 … … 123 124 } 124 125 126 127 128 QList< QStringList > Page::table() const 129 { 130 return m_table; 131 } 132 133 134 void Page::setTable ( const QList< QStringList >& theValue ) 135 { 136 m_table = theValue; 137 } 138 139 void Page::addTableRow(const QStringList & row) 140 { 141 m_table << row; 142 } projects/MyPoint/src/page.h
r287 r330 24 24 #include <QImage> 25 25 #include <QList> 26 #include <QStringList> 27 26 28 #include "point.h" 27 29 /** … … 58 60 QString background( ) const; 59 61 62 void addTableRow( const QStringList &row ); 63 void setTable ( const QList< QStringList >& theValue ); 64 QList< QStringList > table() const; 60 65 61 66 private: 62 67 QString m_title; 63 68 QImage m_image; 69 QList<QStringList> m_table; 64 70 QString m_footer; 65 71 QList<Point*> m_points; projects/MyPoint/src/pdfslidereporter.cpp
r324 r330 22 22 #include "presentation.h" 23 23 #include "point.h" 24 #include "simpleparser.h" 24 25 25 26 #include <QTextDocument> … … 34 35 #include <QDesktopServices> 35 36 #include <QUrl> 37 #include <QStringList> 36 38 37 39 #include "qdebug.h" 38 40 extern int qt_defaultDpi(); 39 41 40 PDFSlideReporter::PDFSlideReporter() : m_painter(0) 42 PDFSlideReporter::PDFSlideReporter() : m_painter(0), m_debugTemplates(false) 41 43 { 42 44 … … 87 89 text->setPageSize( QSizeF(box.size().width() * (dpiScaleX) / textScaleX,box.size().height() * (dpiScaleY) / textScaleY ) ); 88 90 89 // painter->drawRect( box ); // Debug templates... 91 painter->setPen(Qt::red); 92 if( m_debugTemplates ) 93 painter->drawRect( box ); // Debug templates... 90 94 painter->save(); 91 95 painter->translate( box.x(), box.y() ); … … 93 97 painter->scale( textScaleX, textScaleY); 94 98 painter->setPen(Qt::blue); 95 // painter->drawRect( QRectF( QPointF(0,0), text->pageSize() ) ); 99 if( m_debugTemplates ) 100 painter->drawRect( QRectF( QPointF(0,0), text->pageSize() ) ); 96 101 text->drawContents(painter); 97 102 painter->restore(); … … 228 233 footnoteText = presentation->footer(); 229 234 printTextBox( 230 generatePageRect( size, footer ),231 footnoteText,232 m_painter, "second.footer" );233 234 printTextBox( 235 generatePageRect( size, title),236 block->title(),237 painter, "second.title");238 239 printTextBox( 240 generatePageRect( size, pgnumber),241 QString::number(presentation->pages().indexOf(*block) + 1),242 painter, "second.pgNumber" );235 generatePageRect( size, footer ), 236 footnoteText, 237 m_painter, "second.footer" ); 238 239 printTextBox( 240 generatePageRect( size, title), 241 block->title(), 242 painter, "second.title"); 243 244 printTextBox( 245 generatePageRect( size, pgnumber), 246 QString::number(presentation->pages().indexOf(*block) + 1), 247 painter, "second.pgNumber" ); 243 248 244 249 QTextDocument doc; 245 250 doc.setDefaultStyleSheet("p, li { white-space: pre-wrap; }"); 251 252 QString htmlTable = generateTableContent( block ); 253 qDebug() << "Table" << htmlTable; 246 254 247 255 QString htmlList; … … 307 315 } 308 316 317 318 309 319 QString PDFSlideReporter::openFont( const QString &fontName, const QString &color ) const 310 320 { … … 365 375 return fileName; 366 376 } 377 378 379 bool PDFSlideReporter::debugTemplates() const 380 { 381 return m_debugTemplates; 382 } 383 384 385 void PDFSlideReporter::setDebugTemplates ( bool theValue ) 386 { 387 m_debugTemplates = theValue; 388 } 389 390 QString PDFSlideReporter::generateTableContent(Page * block) 391 { 392 QString table; 393 394 if( !block->table().isEmpty() ) 395 { 396 table += "<table>"; 397 foreach( QStringList line, block->table() ) 398 { 399 table += "<tr>"; 400 foreach( QString cell, line ) 401 table += "<td>" + SimpleParser::formatWikiText( cell ) + "</td>"; 402 table += "</tr>"; 403 } 404 405 table += "</table>"; 406 } 407 return table; 408 } projects/MyPoint/src/pdfslidereporter.h
r303 r330 65 65 QString readDefaultBackground( const QString &templateFile, const QString &page, const QString &defaultValue = QString() ) const; 66 66 67 void setDebugTemplates ( bool theValue ); 68 69 70 bool debugTemplates() const; 71 72 67 73 68 74 private: 69 75 void generateTitlePage( Presentation *block, const QSizeF &size ); 70 76 void generateContentPage( Presentation *presentation, Page *block, QPainter *painter, const QSizeF &size ); // generate the page itself (title, body, etc...) 77 QString generateTableContent( Page *block ); 71 78 void generateContentPageList( Point *block, QString *writer ); // generate the outline html for the page 72 79 QString openFont( const QString &fontName = "sans-serif", const QString &color = "#000000" ) const; … … 91 98 QPainter *m_painter; 92 99 QString m_templateName; 100 bool m_debugTemplates; 93 101 }; 94 102 projects/MyPoint/src/simpleparser.cpp
r329 r330 114 114 { 115 115 QStringList cells = line.split( "||" , QString::SkipEmptyParts); 116 qDebug() << cells;116 newPage.addTableRow( cells ); 117 117 } 118 118 else if( direction( line, &captureText ) ) projects/MyPoint/src/src.pro
r324 r330 12 12 thread \ 13 13 qt \ 14 release14 debug 15 15 TARGET = ../bin/mypoint 16 16 … … 32 32 target.path += /usr/bin 33 33 INSTALLS += target 34 CONFIG -= debug35 34 36 35 QT += xml \ projects/MyPoint/src/wikirpc.cpp
r328 r330 73 73 return m_method->invoke( "wiki.wikiToHtml", wikiText ).toString(); 74 74 } 75 76 WikiRPC::PageInfo WikiRPC::getPageInfo(const QString & pagename) const 77 { 78 QVariantMap map = m_method->invoke( "wiki.getPageInfo", pagename ).toMap(); 79 PageInfo pageInfo = { map["name"].toString(), 80 map["lastModified"].toDateTime(), 81 map["author"].toString(), 82 map["version"].toInt() }; 83 return pageInfo; 84 } 85 86 bool WikiRPC::putPage(const QString & pagename, const QString & content, const PageAttributes & attributes) const 87 { 88 QMap<QString,QVariant> map; 89 map["author"] = attributes.author; 90 map["readOnly"] = attributes.readOnly; 91 map["minoredit"] = attributes.minoredit; 92 map["comment"] = attributes.comment; 93 94 return m_method->invoke( "wiki.putPage", pagename, content, map ).toBool(); 95 } 96 97 bool WikiRPC::deleteAttachment(const QString & attachmentName) const 98 { 99 return m_method->invoke( "wiki.deleteAttachment", attachmentName ).toBool(); 100 } 101 102 bool WikiRPC::putAttachment(const QString & attachmentName, const QByteArray & data) const 103 { 104 return m_method->invoke( "wiki.putAttachment", attachmentName, data ).toBool(); 105 } 106 107 QList< WikiRPC::PageInfo > WikiRPC::getRecentChanges(const QDateTime & timestamp) const 108 { 109 QList<PageInfo> pageInfos; 110 QVariantList infos = m_method->invoke( "wiki.getRecentChanges", timestamp ).toList(); 111 foreach( QVariant info, infos ) 112 { 113 QVariantMap map = info.toMap(); 114 PageInfo pageInfo = { map["name"].toString(), 115 map["lastModified"].toDateTime(), 116 map["author"].toString(), 117 map["version"].toInt() }; 118 pageInfos << pageInfo; 119 } 120 121 return pageInfos; 122 } projects/MyPoint/src/wikirpc.h
r328 r330 23 23 #include <QObject> 24 24 #include <QUrl> 25 #include <QMap> 26 #include <QDateTime> 25 27 26 28 namespace KRPC … … 37 39 Q_OBJECT 38 40 public: 41 42 struct PageInfo 43 { 44 QString name; 45 QDateTime lastModified; 46 QString author; 47 int version; 48 }; 49 50 struct PageAttributes 51 { 52 QString comment; 53 bool minoredit; 54 bool readOnly; 55 QString author; 56 }; 57 39 58 WikiRPC( const QString &rpcUrl, QObject *parent = 0 ); 40 41 59 ~WikiRPC(); 42 60 61 QStringList getAllPages() const; 62 QList<PageInfo> getRecentChanges( const QDateTime & timestamp ) const; 43 63 QString getPage( const QString &pagename ) const; 44 64 QString getPageHTML( const QString &pagename ) const; 45 65 QString wikiToHtml(const QString &wikiText ) const; 66 PageInfo getPageInfo(const QString &pagename ) const; 67 bool putPage(const QString &pagename, const QString &content, const PageAttributes &attributes) const; 68 46 69 QStringList listAttachments( const QString &pagename ) const; 47 70 QByteArray getAttachment( const QString &attachmentName ) const; 48 QStringList getAllPages() const; 71 bool deleteAttachment(const QString &attachmentName) const; 72 bool putAttachment(const QString &attachmentName, const QByteArray &data ) const; 49 73 50 74 private slots:
