1 /* Copyright (C) 2003-2006 Jesper K. Pedersen <blackie@kde.org>
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public
5 License as published by the Free Software Foundation; either
6 version 2 of the License, or (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; see the file COPYING. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #include "MiniViewer.h"
20 #include <qpushbutton.h>
25 #include "DB/ImageInfo.h"
28 using namespace ImportExport
;
30 MiniViewer
* MiniViewer::_instance
= 0;
32 void MiniViewer::show( QImage img
, DB::ImageInfoPtr info
, QWidget
* parent
)
35 _instance
= new MiniViewer( parent
);
37 if ( info
->angle() != 0 ) {
39 matrix
.rotate( info
->angle() );
40 img
= img
.transformed( matrix
);
42 if ( img
.width() > 800 || img
.height() > 600 )
43 img
= img
.scaled( 800, 600, Qt::KeepAspectRatio
);
45 _instance
->_pixmap
->setPixmap( QPixmap::fromImage(img
) );
46 _instance
->QDialog::show();
50 void MiniViewer::closeEvent( QCloseEvent
* )
55 void MiniViewer::slotClose()
61 MiniViewer::MiniViewer( QWidget
* parent
): QDialog( parent
)
63 QVBoxLayout
* vlay
= new QVBoxLayout( this );
64 _pixmap
= new QLabel( this );
65 vlay
->addWidget( _pixmap
);
66 QHBoxLayout
* hlay
= new QHBoxLayout
;
67 vlay
->addLayout(hlay
);
69 QPushButton
* but
= new QPushButton( i18n("Close"), this );
70 connect( but
, SIGNAL( clicked() ), this, SLOT( slotClose() ) );
71 hlay
->addWidget( but
);
74 #include "MiniViewer.moc"