~ubuntu-branches/ubuntu/wily/kid3/wily-proposed

« back to all changes in this revision

Viewing changes to src/gui/widgets/imageviewer.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2012-05-14 18:27:44 UTC
  • mfrom: (1.1.14) (2.1.16 sid)
  • Revision ID: package-import@ubuntu.com-20120514182744-4tul4661q4rao8vm
Tags: 2.1-2
Remove patch 01-gcc4.7-ftbfs, it was merged with 2.1 to another location.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * \author Urs Fleisch
7
7
 * \date 10 Jun 2009
8
8
 *
9
 
 * Copyright (C) 2003-2007  Urs Fleisch
 
9
 * Copyright (C) 2003-2012  Urs Fleisch
10
10
 *
11
11
 * This file is part of Kid3.
12
12
 *
46
46
  setModal(true);
47
47
  setWindowTitle(i18n("View Picture"));
48
48
  QVBoxLayout* vlayout = new QVBoxLayout(this);
49
 
  if (!vlayout) {
50
 
    return ;
51
 
  }
52
49
  vlayout->setSpacing(6);
53
50
  vlayout->setMargin(6);
54
51
  QHBoxLayout* hlayout = new QHBoxLayout;
56
53
                                         QSizePolicy::Minimum);
57
54
  m_image = new QLabel(this);
58
55
  QPushButton* closeButton = new QPushButton(i18n("&Close"), this);
59
 
  if (hlayout && m_image && closeButton) {
60
 
    m_image->setScaledContents(true);
61
 
    QSize imageSize(img.size());
62
 
    QSize desktopSize(QApplication::desktop()->availableGeometry().size());
63
 
    desktopSize -= QSize(12, 12);
64
 
    if (imageSize.width() > desktopSize.width() ||
65
 
        imageSize.height() > desktopSize.height()) {
66
 
      m_image->setPixmap(QPixmap::fromImage(img.scaled(desktopSize, Qt::KeepAspectRatio)));
67
 
    } else {
68
 
      m_image->setPixmap(QPixmap::fromImage(img));
69
 
    }
70
 
    vlayout->addWidget(m_image);
71
 
    hlayout->addItem(hspacer);
72
 
    hlayout->addWidget(closeButton);
73
 
    connect(closeButton, SIGNAL(clicked()), this, SLOT(accept()));
74
 
    vlayout->addLayout(hlayout);
 
56
  m_image->setScaledContents(true);
 
57
  QSize imageSize(img.size());
 
58
  QSize desktopSize(QApplication::desktop()->availableGeometry().size());
 
59
  desktopSize -= QSize(12, 12);
 
60
  if (imageSize.width() > desktopSize.width() ||
 
61
      imageSize.height() > desktopSize.height()) {
 
62
    m_image->setPixmap(QPixmap::fromImage(img.scaled(desktopSize, Qt::KeepAspectRatio)));
 
63
  } else {
 
64
    m_image->setPixmap(QPixmap::fromImage(img));
75
65
  }
 
66
  vlayout->addWidget(m_image);
 
67
  hlayout->addItem(hspacer);
 
68
  hlayout->addWidget(closeButton);
 
69
  connect(closeButton, SIGNAL(clicked()), this, SLOT(accept()));
 
70
  vlayout->addLayout(hlayout);
76
71
}
77
72
 
78
73