Main Page   Compound List   File List   Compound Members   File Members  

main.cpp File Reference

#include <qapplication.h>
#include <qlayout.h>
#include "gui/window.h"
#include "config.h"
#include <iostream.h>

Go to the source code of this file.

Defines

#define DEFAULT_WIDTH   875
#define DEFAULT_HEIGHT   620

Functions

int main (int argc, char **argv)


Define Documentation

#define DEFAULT_HEIGHT   620
 

Definition at line 34 of file main.cpp.

Referenced by main().

#define DEFAULT_WIDTH   875
 

Definition at line 33 of file main.cpp.

Referenced by main().


Function Documentation

int main int  argc,
char **  argv
 

Definition at line 36 of file main.cpp.

References DEFAULT_HEIGHT, DEFAULT_WIDTH, and IMAGE_PATH.

00037 { 
00038   //set image path
00039   if(argc > 1)
00040     IMAGE_PATH = QString(argv[1]).replace("/usr/local/bin", "/usr/local/share/albumshaper") + "/images/";
00041   else
00042     IMAGE_PATH = "images/";
00043   
00044   QApplication a(argc, argv);
00045 
00046   Window window;
00047   a.setMainWidget( &window );
00048   window.show();
00049 
00050   //determine default window size
00051   
00052   //set defaults
00053   int width = DEFAULT_WIDTH;
00054   int height = DEFAULT_HEIGHT;
00055   
00056   //if window size greater than desktop available then decrease
00057   QDesktopWidget *desktop = QApplication::desktop();
00058   if(width > desktop->width())
00059   { width = desktop->width(); }
00060   if(height > desktop->height())
00061   { height = desktop->height(); }
00062   
00063   //if window already must be larger than defaults then enlarge
00064   if(width < window.geometry().width())
00065   { width = window.geometry().width(); }
00066   if(height < window.geometry().height())
00067   { height = window.geometry().height(); }
00068   
00069   //compute offsets such that window centered on screen
00070   int xOffset = (desktop->width() - width) / 2;
00071   int yOffset = (desktop->height() - height) / 2;
00072   
00073   //set size and offset and show window
00074   window.setGeometry(xOffset, yOffset, width, height);
00075   window.repaint();
00076   a.exec();
00077 }


Generated on Tue Jun 10 23:41:22 2003 for AlbumShaper by doxygen 1.3.1