main.cpp
changeset 287 557a4e13afef
parent 266 7d91b35c1b6f
child 294 3492af261af2
     1.1 --- a/main.cpp	Tue Mar 28 20:04:04 2006 +0000
     1.2 +++ b/main.cpp	Mon Apr 10 11:21:35 2006 +0000
     1.3 @@ -11,10 +11,6 @@
     1.4  #include "options.h"
     1.5  #include "mainwindow.h"
     1.6  
     1.7 -#include "icons/vym-48x48.xpm"
     1.8 -#include "icons/vym-128x128.xpm"
     1.9 -#include "icons/vym-editor.xpm"
    1.10 -
    1.11  #include "flagrowobj.h"
    1.12  
    1.13  // Global variables
    1.14 @@ -25,6 +21,8 @@
    1.15  QString tmpVymDir;				// All temp files go there, created in mainwindow
    1.16  QString clipboardDir;			// Clipboard used in all mapEditors
    1.17  QDir vymBaseDir;				// Containing all styles, scripts, images, ...
    1.18 +QString iconPath;				// Pointing to icons used for toolbars
    1.19 +QString flagsPath;				// Pointing to flags
    1.20  bool clipboardEmpty;			
    1.21  FlagRowObj *systemFlagsDefault;	// used to copy from in LinkableMapObj
    1.22  FlagRowObj *standardFlagsDefault;
    1.23 @@ -160,10 +158,18 @@
    1.24  	
    1.25  	// Use /usr/share/vym or /usr/local/share/vym or . ?
    1.26  	QDir vymBaseDir;
    1.27 +
    1.28 +	// First try options
    1.29  	if (options.isOn ("local"))
    1.30  	{
    1.31  		vymBaseDir.setPath (vymBaseDir.currentDirPath());
    1.32 -	}else
    1.33 +	} else
    1.34 +	// then look for environment variable
    1.35 +	if (getenv("VYMHOME")!=0)
    1.36 +	{
    1.37 +		vymBaseDir.setPath (getenv("VYMHOME"));
    1.38 +	} else
    1.39 +	// ok, let's find my way on my own
    1.40  	{
    1.41  		vymBaseDir.setPath ("/usr/share/vym");
    1.42  		if (!vymBaseDir.exists())
    1.43 @@ -172,6 +178,9 @@
    1.44  			vymBaseDir.setPath(vymBaseDir.currentDirPath() );
    1.45  	}
    1.46  
    1.47 +	iconPath=vymBaseDir.path()+"/icons/";
    1.48 +	flagsPath=vymBaseDir.path()+"/flags/";
    1.49 +
    1.50  	if (options.isOn ("help"))
    1.51  	{
    1.52  		cout << options.getHelpText()<<endl;
    1.53 @@ -186,7 +195,7 @@
    1.54  
    1.55  
    1.56      QMimeSourceFactory *factory = QMimeSourceFactory::defaultFactory();
    1.57 -    factory->setPixmap("vym_128x128", QPixmap(vym_128x128_xpm));
    1.58 +    factory->setPixmap("vym-128x128", QPixmap(iconPath+"vym-128x128.png"));
    1.59      qInitNetworkProtocols();
    1.60  
    1.61  
    1.62 @@ -203,13 +212,13 @@
    1.63  
    1.64  	// Initialize window of TextEditor
    1.65  	textEditor = new TextEditor();
    1.66 -	textEditor->setIcon (QPixmap (vym_editor_xpm));
    1.67 +	textEditor->setIcon (QPixmap (iconPath+"vym-editor.png"));
    1.68  	if (textEditor->showWithMain()) textEditor->show();
    1.69  
    1.70  	// Initialize mainwindow 
    1.71      Main m;
    1.72  	//m.resize(m.sizeHint());
    1.73 -	m.setIcon (QPixmap (vym_48x48_xpm));
    1.74 +	m.setIcon (QPixmap (iconPath+"vym-48x48.png"));
    1.75  	m.show();
    1.76  	m.fileNew();
    1.77  	m.loadCmdLine();