1 #include <QApplication>
3 //#include <QTranslator>
5 //#include <QTextCodec>
7 //#include <QActionGroup>
11 #include "mainwindow.h"
12 #include "flagrowobj.h"
15 TextEditor *textEditor; // used in Constr. of LinkableMapObj
16 // initialized in mainwindow
18 Main *mainWindow; // used in BranchObj::select()
19 QString tmpVymDir; // All temp files go there, created in mainwindow
20 QString clipboardDir; // Clipboard used in all mapEditors
21 QDir vymBaseDir; // Containing all styles, scripts, images, ...
24 QString iconPath; // Pointing to icons used for toolbars
25 QString flagsPath; // Pointing to flags
27 FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
28 FlagRowObj *standardFlagsDefault;
31 Settings settings ("InSilmaril","vym"); // Organization, Application name
36 int statusbarTime=3500;
38 int main(int argc, char* argv[])
40 //Q_INIT_RESOURCE (application);
42 QApplication app(argc,argv);
45 // Reading and initializing options commandline options
46 options.add ("version", SwitchOption, "v","version");
47 options.add ("local", SwitchOption, "l", "local");
48 options.add ("help", SwitchOption, "h", "help");
49 options.add ("quit", SwitchOption, "q", "quit");
50 options.add ("test", StringOption, "t", "test");
52 "VYM - View Your Mind\n"
53 "--------------------\n\n"
54 "Information about vym can be found in vym.pdf,\n"
55 "which should be part of the vym package.\n"
56 "It is also available at the project homepage:\n\n"
57 "http://www.InSilmaril.de/vym\n");
60 cout << endl << options.getHelpText().ascii()<<endl;
64 if (options.isOn ("version"))
66 cout << "vym version "<<__VYM_VERSION
67 <<" (c) 2004-2006 Uwe Drechsel - "
73 // Use /usr/share/vym or /usr/local/share/vym or . ?
75 if (options.isOn ("local"))
77 vymBaseDir.setPath (vymBaseDir.currentDirPath());
79 // then look for environment variable
80 if (getenv("VYMHOME")!=0)
82 vymBaseDir.setPath (getenv("VYMHOME"));
84 // ok, let's find my way on my own
86 #if defined (Q_OS_MACX)
87 vymBaseDir.setPath(vymBaseDir.currentDirPath() +"/vym.app/Contents/Resources");
90 vymBaseDir.setPath ("/usr/share/vym");
91 if (!vymBaseDir.exists())
93 vymBaseDir.setPath ("/usr/local/share/vym");
94 if (!vymBaseDir.exists())
95 vymBaseDir.setPath(vymBaseDir.currentDirPath() );
100 iconPath=vymBaseDir.path()+"/icons/";
101 flagsPath=vymBaseDir.path()+"/flags/";
104 lastImageDir=QDir().current();
105 lastFileDir=QDir().current();
107 if (options.isOn ("help"))
109 cout << options.getHelpText().ascii()<<endl;
113 q3InitNetworkProtocols();
116 // Initialize translations
117 QTranslator translator (0);
118 translator.load( QString("vym_")+QTextCodec::locale(), vymBaseDir.path() + "/lang");
119 app.installTranslator( &translator );
121 // Initializing the row of system flags
122 // is done in first call to MapEditor(),
123 // because we need at least one canvas first
124 systemFlagsDefault=NULL;
125 standardFlagsDefault=NULL;
127 // Initialize window of TextEditor
128 textEditor = new TextEditor();
129 textEditor->setIcon (QPixmap (iconPath+"vym-editor.png"));
130 if (textEditor->showWithMain()) textEditor->show();
132 // Initialize mainwindow
134 //m.resize(m.sizeHint());
135 m.setIcon (QPixmap (iconPath+"vym-48x48.png"));
140 // For benchmarking we may want to quit immediatly after drawing
141 if (options.isOn ("quit"))
146 QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );