| 1 | /****************************************************************************
|
|---|
| 2 | ** $Id: main.cpp 2 2005-11-16 15:49:26Z dmik $
|
|---|
| 3 | **
|
|---|
| 4 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
|
|---|
| 5 | **
|
|---|
| 6 | ** This file is part of an example program for Qt. This example
|
|---|
| 7 | ** program may be used, distributed and modified without limitation.
|
|---|
| 8 | **
|
|---|
| 9 | *****************************************************************************/
|
|---|
| 10 |
|
|---|
| 11 | #include "showimg.h"
|
|---|
| 12 | #include "imagefip.h"
|
|---|
| 13 | #include <qapplication.h>
|
|---|
| 14 | #include <qimage.h>
|
|---|
| 15 |
|
|---|
| 16 | int main( int argc, char **argv )
|
|---|
| 17 | {
|
|---|
| 18 | if ( argc > 1 && QString(argv[1]) == "-m" ) {
|
|---|
| 19 | QApplication::setColorSpec( QApplication::ManyColor );
|
|---|
| 20 | argc--;
|
|---|
| 21 | argv++;
|
|---|
| 22 | }
|
|---|
| 23 | else if ( argc > 1 && QString(argv[1]) == "-n" ) {
|
|---|
| 24 | QApplication::setColorSpec( QApplication::NormalColor );
|
|---|
| 25 | argc--;
|
|---|
| 26 | argv++;
|
|---|
| 27 | }
|
|---|
| 28 | else {
|
|---|
| 29 | QApplication::setColorSpec( QApplication::CustomColor );
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | QApplication::setFont( QFont("Helvetica", 12) );
|
|---|
| 33 | QApplication a( argc, argv );
|
|---|
| 34 |
|
|---|
| 35 | ImageIconProvider iip;
|
|---|
| 36 | QFileDialog::setIconProvider( &iip );
|
|---|
| 37 |
|
|---|
| 38 | if ( argc <= 1 ) {
|
|---|
| 39 | // Create a window which looks after its own existence.
|
|---|
| 40 | ImageViewer *w =
|
|---|
| 41 | new ImageViewer(0, "new window", Qt::WDestructiveClose | Qt::WResizeNoErase );
|
|---|
| 42 | w->setCaption("Qt Example - Image Viewer");
|
|---|
| 43 | w->show();
|
|---|
| 44 | } else {
|
|---|
| 45 | for ( int i=1; i<argc; i++ ) {
|
|---|
| 46 | // Create a window which looks after its own existence.
|
|---|
| 47 | ImageViewer *w =
|
|---|
| 48 | new ImageViewer(0, argv[i], Qt::WDestructiveClose | Qt::WResizeNoErase );
|
|---|
| 49 | w->setCaption("Qt Example - Image Viewer");
|
|---|
| 50 | w->loadImage( argv[i] );
|
|---|
| 51 | w->show();
|
|---|
| 52 | }
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | QObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()));
|
|---|
| 56 |
|
|---|
| 57 | return a.exec();
|
|---|
| 58 | }
|
|---|