1 #include <QApplication>
6 #include "mainwindow.h"
7 #include "flagrowobj.h"
10 TextEditor *textEditor; // used in Constr. of LinkableMapObj
11 // initialized in mainwindow
13 Main *mainWindow; // used in BranchObj::select()
14 QString tmpVymDir; // All temp files go there, created in mainwindow
15 QString clipboardDir; // Clipboard used in all mapEditors
16 QDir vymBaseDir; // Containing all styles, scripts, images, ...
19 QString iconPath; // Pointing to icons used for toolbars
20 QString flagsPath; // Pointing to flags
22 FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
23 FlagRowObj *standardFlagsDefault;
26 Settings settings ("InSilmaril","vym"); // Organization, Application name
31 int statusbarTime=3500;
33 int main(int argc, char* argv[])
35 //Q_INIT_RESOURCE (application);
37 QApplication app(argc,argv);
40 // Reading and initializing options commandline options
41 options.add ("version", SwitchOption, "v","version");
42 options.add ("local", SwitchOption, "l", "local");
43 options.add ("help", SwitchOption, "h", "help");
44 options.add ("quit", SwitchOption, "q", "quit");
45 options.add ("test", StringOption, "t", "test");
47 "VYM - View Your Mind\n"
48 "--------------------\n\n"
49 "Information about vym can be found in vym.pdf,\n"
50 "which should be part of the vym package.\n"
51 "It is also available at the project homepage:\n\n"
52 "http://www.InSilmaril.de/vym\n");
55 cout << endl << options.getHelpText().ascii()<<endl;
59 if (options.isOn ("version"))
61 cout << "vym version "<<__VYM_VERSION
62 <<" (c) 2004-2006 Uwe Drechsel - "
68 // Use /usr/share/vym or /usr/local/share/vym or . ?
70 if (options.isOn ("local"))
72 vymBaseDir.setPath (vymBaseDir.currentDirPath());
74 // then look for environment variable
75 if (getenv("VYMHOME")!=0)
77 vymBaseDir.setPath (getenv("VYMHOME"));
79 // ok, let's find my way on my own
81 #if defined (Q_OS_MACX)
82 vymBaseDir.setPath(vymBaseDir.currentDirPath() +"/vym.app/Contents/Resources");
85 vymBaseDir.setPath ("/usr/share/vym");
86 if (!vymBaseDir.exists())
88 vymBaseDir.setPath ("/usr/local/share/vym");
89 if (!vymBaseDir.exists())
90 vymBaseDir.setPath(vymBaseDir.currentDirPath() );
95 iconPath=vymBaseDir.path()+"/icons/";
96 flagsPath=vymBaseDir.path()+"/flags/";
99 lastImageDir=QDir().current();
100 lastFileDir=QDir().current();
102 if (options.isOn ("help"))
104 cout << options.getHelpText().ascii()<<endl;
108 q3InitNetworkProtocols();
111 // Initialize translations
112 QTranslator translator (0);
113 translator.load( QString("vym_")+QTextCodec::locale(), vymBaseDir.path() + "/lang");
114 app.installTranslator( &translator );
116 // Initializing the row of system flags
117 // is done in first call to MapEditor(),
118 // because we need at least one canvas first
119 systemFlagsDefault=NULL;
120 standardFlagsDefault=NULL;
122 // Initialize window of TextEditor
123 textEditor = new TextEditor();
124 textEditor->setIcon (QPixmap (iconPath+"vym-editor.png"));
125 if (textEditor->showWithMain()) textEditor->show();
127 // Initialize mainwindow
129 //m.resize(m.sizeHint());
130 m.setIcon (QPixmap (iconPath+"vym-48x48.png"));
135 // For benchmarking we may want to quit immediatly after drawing
136 if (options.isOn ("quit"))
141 QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );