1 #include <qapplication.h>
3 #include <qtranslator.h>
6 #include <qtextcodec.h>
12 #include "mainwindow.h"
14 #include "icons/vym-48x48.xpm"
15 #include "icons/vym-editor.xpm"
17 #include "flagrowobj.h"
20 TextEditor *textEditor; // used in Constr. of LinkableMapObj
21 // initialized in mainwindow
23 Main *mainWindow; // used in BranchObj::select()
24 QString tmpVymDir; // All temp files go there, created in mainwindow
25 QString clipboardDir; // Clipboard used in all mapEditors
27 FlagRowObj *systemFlagsDefault; // used to copy from in LinkableMapObj
28 FlagRowObj *standardFlagsDefault;
31 // (QActionGroup could not be "enabled")
32 QPtrList <QAction> actionListBranches;
34 // Actions which change sometimes
35 QAction *actionFileSave;
36 QAction *actionFilePrint;
37 QAction *actionEditUndo;
38 QAction *actionEditRedo;
39 QAction *actionEditCopy;
40 QAction *actionEditCut;
41 QAction *actionEditPaste;
42 QAction *actionEditMoveUp;
43 QAction *actionEditMoveDown;
44 QAction *actionEditToggleScroll;
45 QAction *actionEditOpenURL;
46 QAction *actionEditURL;
47 QAction *actionEditHeading2URL;
48 QAction *actionEditBugzilla2URL;
49 QAction *actionEditOpenVymLink;
50 QAction *actionEditVymLink;
51 QAction *actionEditDeleteVymLink;
52 QAction *actionEditMapInfo;
53 QAction *actionEditHeading;
54 QAction *actionEditDelete;
55 QAction *actionEditAddBranch;
56 QAction *actionEditAddBranchHere;
57 QAction *actionEditAddBranchAbove;
58 QAction *actionEditAddBranchBelow;
59 QAction *actionEditRemoveBranchHere;
60 QAction *actionEditRemoveChilds;
61 QAction *actionEditImportAdd;
62 QAction *actionEditImportReplace;
63 QAction *actionEditSaveBranch;
64 QAction *actionEditSelectFirst;
65 QAction *actionEditSelectLast;
66 QAction *actionEditLoadImage;
67 QAction *actionEditToggleFloatExport;
69 QAction *actionFormatColor;
70 QAction *actionFormatPickColor;
71 QAction *actionFormatColorBranch;
72 QAction *actionFormatColorSubtree;
73 QAction *actionFormatBackColor;
74 QAction *actionFormatLinkColorHint;
75 QAction *actionFormatLinkColor;
77 QActionGroup *actionGroupModModes;
78 QAction *actionModModeColor;
79 QAction *actionModModeLink;
80 QAction *actionModModeCopy;
82 QActionGroup *actionGroupFormatFrameTypes;
83 QAction *actionFormatFrameNone;
84 QAction *actionFormatFrameRectangle;
86 QActionGroup *actionGroupFormatLinkStyles;
87 QAction *actionFormatHideLinkUnselected;
88 QAction *actionFormatLinkStyleLine;
89 QAction *actionFormatLinkStyleParabel;
90 QAction *actionFormatLinkStylePolyLine;
91 QAction *actionFormatLinkStylePolyParabel;
93 QAction *actionViewToggleNoteEditor;
95 QAction *actionSettingsAutoselectHeading;
96 QAction *actionSettingsAutoselectText;
97 QAction *actionSettingsPasteNewHeading;
98 QAction *actionSettingsAutoedit;
99 QAction *actionSettingsUseDelKey;
100 QAction *actionSettingsUseFlagGroups;
102 QPopupMenu *branchContextMenu;
103 QPopupMenu *branchAddContextMenu;
104 QPopupMenu *branchRemoveContextMenu;
105 QPopupMenu *branchLinksContextMenu;
106 QPopupMenu *branchLinksContextMenuDup;
107 QPopupMenu *floatimageContextMenu;
108 QPopupMenu *saveImageFormatMenu;
109 QPopupMenu *canvasContextMenu;
110 QPopupMenu *lastMapsMenu;
111 QPopupMenu *exportMenu;
112 QPopupMenu *exportImageFormatMenu;
118 int statusbarTime=3500;
120 int main(int argc, char** argv)
122 QApplication app(argc,argv);
124 QMimeSourceFactory *factory = QMimeSourceFactory::defaultFactory();
125 factory->setPixmap("vym_logo", QPixmap(vym_logo_xpm));
126 qInitNetworkProtocols();
128 // Use /usr/share/vym or /usr/local/share/vym or .
130 shareDir.setPath ("/usr/share/vym");
131 if (!shareDir.exists())
132 shareDir.setPath ("/usr/local/share/vym");
133 if (!shareDir.exists())
134 shareDir.setPath(".");
136 // Initialize translations
137 QTranslator translator (0);
138 translator.load( QString("vym_")+QTextCodec::locale(), shareDir.path() + "/lang");
139 app.installTranslator( &translator );
141 // Initializing the row of system flags
142 // is done in first call to MapEditor(),
143 // because we need at least one canvas first
144 systemFlagsDefault=NULL;
145 standardFlagsDefault=NULL;
147 // Reading and initializing options commandline options
148 options.add ("version", SwitchOption, "v","version");
149 options.add ("help", SwitchOption, "h", "help");
150 options.add ("quit", SwitchOption, "q", "quit");
151 options.add ("test", StringOption, "t", "test");
152 options.setHelpText (
153 "VYM - View Your Mind\n"
154 "--------------------\n\n"
155 "Information about vym can be found in vym.pdf,\n"
156 "which should be part of the vym package.\n"
157 "It is also available at the project homepage:\n\n"
158 "http://www.InSilmaril.de/vym\n");
161 cout << endl << options.getHelpText()<<endl;
165 if (options.isOn ("version"))
167 cout << "vym version "<<__VYM_VERSION__
168 <<" (c) 2004 Uwe Drechsel - "
169 <<__BUILD_DATE__<<endl;
174 if (options.isOn ("help"))
176 cout << options.getHelpText()<<endl;
180 if (options.isOn ("test"))
182 // FIXME testing string option only
183 cout << "Testing: "<<options.getArg("test")<< endl;
186 // Initialize window of TextEditor
187 textEditor = new TextEditor();
188 textEditor->setIcon (QPixmap (vym_editor_xpm));
189 if (textEditor->showWithMain()) textEditor->show();
191 // Initialize mainwindow
193 //m.resize(m.sizeHint());
194 m.setIcon (QPixmap (vym_logo_xpm));
199 // For benchmarking we may want to quit immediatly after drawing
200 if (options.isOn ("quit"))
205 QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );