~ubuntu-branches/ubuntu/wily/smplayer/wily

« back to all changes in this revision

Viewing changes to src/videopreview/videopreview.cpp

  • Committer: Package Import Robot
  • Author(s): Mateusz Łukasik, Mateusz Łukasik, Alessio Treglia
  • Date: 2014-09-10 13:50:48 UTC
  • mfrom: (1.3.3)
  • mto: This revision was merged to the branch mainline in revision 27.
  • Revision ID: package-import@ubuntu.com-20140910135048-t043hd88bhpfvfow
[ Mateusz Łukasik ]
* New upstream release.

[ Alessio Treglia ]
* Repackaging upstream sources to get rid of
  zlib/contrib/dotzlib/DotZLib.chm.
* Enable parallel builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
        connect( progress, SIGNAL(canceled()), this, SLOT(cancelPressed()) );
68
68
 
69
69
        w_contents = new QWidget(this);
 
70
        w_contents->setContentsMargins(0, 0, 0, 0);
70
71
        QPalette p = w_contents->palette();
71
72
        p.setColor(w_contents->backgroundRole(), Qt::white);
72
73
        p.setColor(w_contents->foregroundRole(), Qt::black);
79
80
 
80
81
        grid_layout = new QGridLayout;
81
82
        grid_layout->setSpacing(2);
 
83
        grid_layout->setContentsMargins(0, 0, 0, 0);
82
84
 
83
85
        QVBoxLayout * l = new QVBoxLayout;
 
86
        l->setContentsMargins(4, 4, 4, 4);
 
87
        l->setSpacing(0);
84
88
        l->setSizeConstraint(QLayout::SetFixedSize);
85
89
        l->addWidget(info);
86
90
        l->addLayout(grid_layout);
87
91
        l->addWidget(foot);
88
 
        
 
92
 
89
93
        w_contents->setLayout(l);
90
94
 
91
95
        scroll_area = new QScrollArea(this);
324
328
        }
325
329
 
326
330
        if (run.thumbnail_width == 0) {
 
331
                qDebug("VideoPreview::addPicture: horizontalSpacing: %d", grid_layout->horizontalSpacing());
327
332
                int spacing = grid_layout->horizontalSpacing() * (prop.n_cols-1);
 
333
                QMargins m = w_contents->layout()->contentsMargins();
 
334
                qDebug("VideoPreview::addPicture: contentsMargins: %d, %d", m.left(), m.right());
 
335
                spacing += (m.left() + m.right());
328
336
                if (spacing < 0) spacing = 0;
329
337
                qDebug("VideoPreview::addPicture: spacing: %d", spacing);
330
338
                run.thumbnail_width = (prop.max_width - spacing) / prop.n_cols;
525
533
 
526
534
        if (!filename.isEmpty()) {
527
535
                QPixmap image = QPixmap::grabWidget(w_contents);
 
536
                qDebug("VideoPreview::saveImage: size: %d %d", image.size().width(), image.size().height());
 
537
                if (image.size().width() > prop.max_width) {
 
538
                        image = image.scaledToWidth(prop.max_width, Qt::SmoothTransformation);
 
539
                        qDebug("VideoPreview::saveImage: image scaled to : %d %d", image.size().width(), image.size().height());
 
540
                }
528
541
                if (!image.save(filename)) {
529
542
                        // Failed!!!
530
543
                        qDebug("VideoPreview::saveImage: error saving '%s'", filename.toUtf8().constData());