1 #include <QApplication>
4 #include "flagrowobj.h"
5 #include "mainwindow.h"
11 TextEditor *textEditor; // used in Constr. of LinkableMapObj
12 // initialized in mainwindow
17 Main *mainWindow; // used in BranchObj::select()
18 QString tmpVymDir; // All temp files go there, created in mainwindow
19 QString clipboardDir; // Clipboard used in all mapEditors
20 QDir vymBaseDir; // Containing all styles, scripts, images, ...
23 QString iconPath; // Pointing to icons used for toolbars
24 QString flagsPath; // Pointing to flags
26 FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
27 FlagRowObj *standardFlagsDefault;
30 Settings settings ("InSilmaril","vym"); // Organization, Application name
35 int statusbarTime=3500;
37 int main(int argc, char* argv[])
39 //Q_INIT_RESOURCE (application);
41 QApplication app(argc,argv);
44 vymVersion=__VYM_VERSION;
45 vymBuildDate=__VYM_BUILD_DATE;
48 // Reading and initializing options commandline options
49 options.add ("version", SwitchOption, "v","version");
50 options.add ("local", SwitchOption, "l", "local");
51 options.add ("help", SwitchOption, "h", "help");
52 options.add ("quit", SwitchOption, "q", "quit");
53 options.add ("test", StringOption, "t", "test");
55 "VYM - View Your Mind\n"
56 "--------------------\n\n"
57 "Information about vym can be found in vym.pdf,\n"
58 "which should be part of the vym package.\n"
59 "It is also available at the project homepage:\n\n"
60 "http://www.InSilmaril.de/vym\n");
63 cout << endl << options.getHelpText().ascii()<<endl;
67 if (options.isOn ("version"))
69 cout << "vym version "<<__VYM_VERSION
70 <<" (c) 2004-2006 Uwe Drechsel - "
71 <<__VYM_BUILD_DATE<<endl;
76 // Use /usr/share/vym or /usr/local/share/vym or . ?
78 if (options.isOn ("local"))
80 vymBaseDir.setPath (vymBaseDir.currentDirPath());
82 // then look for environment variable
83 if (getenv("VYMHOME")!=0)
85 vymBaseDir.setPath (getenv("VYMHOME"));
87 // ok, let's find my way on my own
89 #if defined (Q_OS_MACX)
90 vymBaseDir.setPath(vymBaseDir.currentDirPath() +"/vym.app/Contents/Resources");
93 vymBaseDir.setPath ("/usr/share/vym");
94 if (!vymBaseDir.exists())
96 vymBaseDir.setPath ("/usr/local/share/vym");
97 if (!vymBaseDir.exists())
98 vymBaseDir.setPath(vymBaseDir.currentDirPath() );
103 iconPath=vymBaseDir.path()+"/icons/";
104 flagsPath=vymBaseDir.path()+"/flags/";
107 lastImageDir=QDir().current();
108 lastFileDir=QDir().current();
110 if (options.isOn ("help"))
112 cout << options.getHelpText().ascii()<<endl;
116 q3InitNetworkProtocols();
119 // Initialize translations
120 QTranslator translator (0);
121 translator.load( QString("vym_")+QTextCodec::locale(), vymBaseDir.path() + "/lang");
122 app.installTranslator( &translator );
124 // Initializing the row of system flags
125 // is done in first call to MapEditor(),
126 // because we need at least one canvas first
127 systemFlagsDefault=NULL;
128 standardFlagsDefault=NULL;
130 // Initialize window of TextEditor
131 textEditor = new TextEditor();
132 textEditor->setIcon (QPixmap (iconPath+"vym-editor.png"));
133 if (textEditor->showWithMain()) textEditor->show();
135 // Initialize mainwindow
137 //m.resize(m.sizeHint());
138 m.setIcon (QPixmap (iconPath+"vym-48x48.png"));
143 // For benchmarking we may want to quit immediatly after drawing
144 if (options.isOn ("quit"))
149 QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );