~ubuntu-branches/ubuntu/wily/marble/wily-proposed

« back to all changes in this revision

Viewing changes to tools/maptheme-previewimage/main.cpp

  • Committer: Package Import Robot
  • Author(s): Scarlett Clark, Jonathan Riddell, Scarlett Clark
  • Date: 2014-07-24 23:38:32 UTC
  • mfrom: (1.5.2)
  • Revision ID: package-import@ubuntu.com-20140724233832-7v4421t4khrhw487
Tags: 4:4.13.90-0ubuntu1
[ Jonathan Riddell ]
* Switch to libmarblewidget19 for new soversion

[ Scarlett Clark ]
* New upstream beta release
* Update: do_not_install_private_headers. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
//
10
10
 
11
11
#include <MarbleWidget.h>
 
12
#include <MarbleModel.h>
 
13
#include <GeoDataTreeModel.h>
12
14
#include <RenderPlugin.h>
13
15
 
14
16
#include <QDebug>
17
19
#include <QPainter>
18
20
#include <QProcess>
19
21
#include <QDir>
 
22
#include <QThread>
20
23
 
21
24
using namespace Marble;
22
25
 
 
26
class Cheeeeze : private QThread { public: using QThread::msleep; };
 
27
 
23
28
QPixmap resize(const QPixmap &pixmap)
24
29
{
25
30
    if ( QProcess::execute("convert -version") == 0 ) {
66
71
    QPixmap canvas( ":/canvas.png" );
67
72
    Q_ASSERT(!canvas.isNull());
68
73
    QPainter globePainter( &canvas );
 
74
 
 
75
    // Hack: Wait up to ten seconds for six documents to be parsed.
 
76
    // We need proper load progress signalization in Marble
 
77
    for ( int i=0; i<400 && mapWidget->model()->treeModel()->rowCount() < 6; ++i ) {
 
78
        Cheeeeze::msleep( 25 );
 
79
        app.processEvents();
 
80
    }
69
81
    QPixmap const globe = QPixmap::grabWidget( mapWidget );
70
82
    globePainter.drawPixmap( QPoint( 2, 2 ), resize( globe ) );
71
83
    globePainter.end();