historywindow moved to mainwindow. Started to get rid of Q3PtrList finally
1 #include <QApplication>
4 #include "flagrowobj.h"
5 #include "mainwindow.h"
11 TextEditor *textEditor; // used in Constr. of LinkableMapObj
12 // initialized in mainwindow
13 QString vymName(__VYM_NAME);
14 QString vymVersion(__VYM_VERSION);
15 QString vymBuildDate(__VYM_BUILD_DATE);
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 // Reading and initializing options commandline options
45 options.add ("version", SwitchOption, "v","version");
46 options.add ("local", SwitchOption, "l", "local");
47 options.add ("help", SwitchOption, "h", "help");
48 options.add ("quit", SwitchOption, "q", "quit");
49 options.add ("test", StringOption, "t", "test");
51 "VYM - View Your Mind\n"
52 "--------------------\n\n"
53 "Information about vym can be found in vym.pdf,\n"
54 "which should be part of the vym package.\n"
55 "It is also available at the project homepage:\n\n"
56 "http://www.InSilmaril.de/vym\n");
59 cout << endl << options.getHelpText().ascii()<<endl;
63 if (options.isOn ("version"))
65 cout << "vym version "<<__VYM_VERSION
66 <<" (c) 2004-2006 Uwe Drechsel - "
67 <<__VYM_BUILD_DATE<<endl;
72 // Use /usr/share/vym or /usr/local/share/vym or . ?
74 if (options.isOn ("local"))
76 vymBaseDir.setPath (vymBaseDir.currentDirPath());
78 // then look for environment variable
79 if (getenv("VYMHOME")!=0)
81 vymBaseDir.setPath (getenv("VYMHOME"));
83 // ok, let's find my way on my own
85 #if defined (Q_OS_MACX)
86 vymBaseDir.setPath(vymBaseDir.currentDirPath() +"/vym.app/Contents/Resources");
89 vymBaseDir.setPath ("/usr/share/vym");
90 if (!vymBaseDir.exists())
92 vymBaseDir.setPath ("/usr/local/share/vym");
93 if (!vymBaseDir.exists())
94 vymBaseDir.setPath(vymBaseDir.currentDirPath() );
99 iconPath=vymBaseDir.path()+"/icons/";
100 flagsPath=vymBaseDir.path()+"/flags/";
103 lastImageDir=QDir().current();
104 lastFileDir=QDir().current();
106 if (options.isOn ("help"))
108 cout << options.getHelpText().ascii()<<endl;
112 q3InitNetworkProtocols();
115 // Initialize translations
116 QTranslator translator (0);
117 translator.load( QString("vym_")+QTextCodec::locale(), vymBaseDir.path() + "/lang");
118 app.installTranslator( &translator );
120 // Initializing the row of system flags
121 // is done in first call to MapEditor(),
122 // because we need at least one canvas first
123 systemFlagsDefault=NULL;
124 standardFlagsDefault=NULL;
126 // Initialize window of TextEditor
127 textEditor = new TextEditor();
128 textEditor->setIcon (QPixmap (iconPath+"vym-editor.png"));
129 if (textEditor->showWithMain()) textEditor->show();
131 // Initialize mainwindow
133 //m.resize(m.sizeHint());
134 m.setIcon (QPixmap (iconPath+"vym-48x48.png"));
139 // For benchmarking we may want to quit immediatly after drawing
140 if (options.isOn ("quit"))
145 QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );