main.cpp
author insilmaril
Wed, 06 May 2009 11:06:17 +0000
branchrelease-1-12-maintained
changeset 69 053479bc23c6
parent 0 7a96bd401351
child 2 608f976aa7bb
child 79 32f499cbe874
child 89 9db3eaa21237
permissions -rw-r--r--
added lyx file for french translation
insilmaril@0
     1
#include <qapplication.h>
insilmaril@0
     2
#include <qpixmap.h>
insilmaril@0
     3
#include <qtranslator.h>
insilmaril@0
     4
insilmaril@0
     5
#include "settings.h"
insilmaril@0
     6
#include "options.h"
insilmaril@0
     7
#include "mainwindow.h"
insilmaril@0
     8
insilmaril@0
     9
#include "icons/vym-48x48.xpm"
insilmaril@0
    10
#include "icons/vym-editor.xpm"
insilmaril@0
    11
insilmaril@0
    12
#include "flagrowobj.h"
insilmaril@0
    13
insilmaril@0
    14
// Global variables
insilmaril@0
    15
TextEditor *textEditor;			// used in Constr. of LinkableMapObj
insilmaril@0
    16
								// initialized in mainwindow
insilmaril@0
    17
insilmaril@0
    18
Main *mainWindow;				// used in BranchObj::select()								
insilmaril@0
    19
MapEditor *clipboardME;			
insilmaril@0
    20
FlagRowObj *systemFlagsDefault;	// used to copy from in LinkableMapObj
insilmaril@0
    21
FlagRowObj *standardFlagsDefault;
insilmaril@0
    22
insilmaril@0
    23
// Actions which change sometimes
insilmaril@0
    24
QAction *actionFileSave;
insilmaril@0
    25
QAction *actionFilePrint;
insilmaril@0
    26
QAction *actionEditUndo;
insilmaril@0
    27
QAction *actionEditCopy;
insilmaril@0
    28
QAction *actionEditCut;
insilmaril@0
    29
QAction *actionEditPaste;
insilmaril@0
    30
QAction *actionEditMoveUp;
insilmaril@0
    31
QAction *actionEditMoveDown;
insilmaril@0
    32
QAction *actionEditToggleScroll;
insilmaril@0
    33
QAction *actionEditOpenURL;
insilmaril@0
    34
QAction *actionEditURL;
insilmaril@0
    35
QAction *actionEditHeading2URL;
insilmaril@0
    36
QAction *actionEditBugzilla2URL;
insilmaril@0
    37
QAction *actionEditOpenVymLink;
insilmaril@0
    38
QAction *actionEditVymLink;
insilmaril@0
    39
QAction *actionEditDeleteVymLink;
insilmaril@0
    40
QAction *actionEditMapInfo;
insilmaril@0
    41
QAction *actionEditHeading;
insilmaril@0
    42
QAction *actionEditDelete;
insilmaril@0
    43
QAction *actionEditAddBranch;
insilmaril@0
    44
QAction *actionEditAddBranchAbove;
insilmaril@0
    45
QAction *actionEditAddBranchBelow;
insilmaril@0
    46
QAction *actionEditImportAdd;
insilmaril@0
    47
QAction *actionEditImportReplace;
insilmaril@0
    48
QAction *actionEditSaveBranch;
insilmaril@0
    49
QAction *actionEditSelectFirst;
insilmaril@0
    50
QAction *actionEditSelectLast;
insilmaril@0
    51
QAction *actionEditLoadImage;
insilmaril@0
    52
QAction *actionEditToggleFloatExport;
insilmaril@0
    53
insilmaril@0
    54
QAction *actionFormatColor;		
insilmaril@0
    55
QAction *actionFormatPickColor;		
insilmaril@0
    56
QAction *actionFormatColorBranch;
insilmaril@0
    57
QAction *actionFormatColorSubtree;
insilmaril@0
    58
QAction *actionFormatBackColor;
insilmaril@0
    59
QAction *actionFormatLinkColorHint;
insilmaril@0
    60
QAction *actionFormatLinkColor;		
insilmaril@0
    61
insilmaril@0
    62
QActionGroup *actionGroupFormatFrameTypes;
insilmaril@0
    63
QAction *actionFormatFrameNone;
insilmaril@0
    64
QAction *actionFormatFrameRectangle;
insilmaril@0
    65
insilmaril@0
    66
QActionGroup *actionGroupFormatLinkStyles;
insilmaril@0
    67
QAction *actionFormatLinkStyleLine;
insilmaril@0
    68
QAction *actionFormatLinkStyleParabel;
insilmaril@0
    69
QAction *actionFormatLinkStylePolyLine;
insilmaril@0
    70
QAction *actionFormatLinkStylePolyParabel;
insilmaril@0
    71
insilmaril@0
    72
QAction *actionViewToggleNoteEditor;
insilmaril@0
    73
insilmaril@0
    74
QAction *actionSettingsAutoselectHeading;
insilmaril@0
    75
QAction *actionSettingsAutoselectText;
insilmaril@0
    76
QAction *actionSettingsPasteNewHeading;
insilmaril@0
    77
QAction *actionSettingsAutoedit;
insilmaril@0
    78
QAction *actionSettingsUseDelKey;
insilmaril@0
    79
insilmaril@0
    80
QPopupMenu *branchContextMenu;
insilmaril@0
    81
QPopupMenu *floatimageContextMenu;
insilmaril@0
    82
QPopupMenu *saveImageFormatMenu;
insilmaril@0
    83
QPopupMenu *canvasContextMenu;
insilmaril@0
    84
QPopupMenu *lastMapsMenu;
insilmaril@0
    85
QPopupMenu *exportMenu;
insilmaril@0
    86
QPopupMenu *exportImageFormatMenu;
insilmaril@0
    87
insilmaril@0
    88
insilmaril@0
    89
Settings settings;
insilmaril@0
    90
Options options;
insilmaril@0
    91
insilmaril@0
    92
int statusbarTime=3500;
insilmaril@0
    93
insilmaril@0
    94
int main(int argc, char** argv)
insilmaril@0
    95
{
insilmaril@0
    96
    QApplication app(argc,argv);
insilmaril@0
    97
insilmaril@0
    98
insilmaril@0
    99
	// Initialize translations
insilmaril@0
   100
	QTranslator translator (0);
insilmaril@0
   101
	translator.load( "vym_de", "." );
insilmaril@0
   102
    app.installTranslator( &translator );
insilmaril@0
   103
insilmaril@0
   104
	// Initializing the row of system flags
insilmaril@0
   105
	// is done in first call to MapEditor(),
insilmaril@0
   106
	// because we need at least one canvas first
insilmaril@0
   107
	systemFlagsDefault=NULL;
insilmaril@0
   108
	standardFlagsDefault=NULL;
insilmaril@0
   109
insilmaril@0
   110
	// Reading and initializing options commandline options
insilmaril@0
   111
	options.add ("version", SwitchOption, "v","version");
insilmaril@0
   112
	options.add ("help", SwitchOption, "h", "help");
insilmaril@0
   113
	options.add ("quit", SwitchOption, "q", "quit");
insilmaril@0
   114
	options.add ("test", StringOption, "t", "test");
insilmaril@0
   115
	options.setHelpText (
insilmaril@0
   116
		"VYM - View Your Mind\n"
insilmaril@0
   117
		"--------------------\n\n"
insilmaril@0
   118
		"Information about vym can be found in vym.pdf,\n"
insilmaril@0
   119
		"which should be part of the vym package.\n"
insilmaril@0
   120
		"It is also available at the project homepage:\n\n"
insilmaril@0
   121
		"http://www.InSilmaril.de/vym\n");
insilmaril@0
   122
	if (options.parse())
insilmaril@0
   123
	{
insilmaril@0
   124
		cout << endl << options.getHelpText()<<endl;
insilmaril@0
   125
		return 1;
insilmaril@0
   126
	}
insilmaril@0
   127
insilmaril@0
   128
	if (options.isOn ("version"))
insilmaril@0
   129
	{
insilmaril@0
   130
		cout << "vym version "<<__VYM_VERSION__
insilmaril@0
   131
			<<"  (c) 2004 Uwe Drechsel - "
insilmaril@0
   132
			<<__BUILD_DATE__<<endl;
insilmaril@0
   133
			
insilmaril@0
   134
		return 0;	
insilmaril@0
   135
	}		
insilmaril@0
   136
	
insilmaril@0
   137
	if (options.isOn ("help"))
insilmaril@0
   138
	{
insilmaril@0
   139
		cout << options.getHelpText()<<endl;
insilmaril@0
   140
		return 0;	
insilmaril@0
   141
	}	
insilmaril@0
   142
insilmaril@0
   143
	if (options.isOn ("test"))
insilmaril@0
   144
	{
insilmaril@0
   145
		// FIXME testing string option only
insilmaril@0
   146
		cout << "Testing: "<<options.getArg("test")<< endl;
insilmaril@0
   147
	}	
insilmaril@0
   148
insilmaril@0
   149
	// Initialize window of TextEditor
insilmaril@0
   150
	textEditor = new TextEditor();
insilmaril@0
   151
	textEditor->setIcon (QPixmap (vym_editor_xpm));
insilmaril@0
   152
	if (textEditor->showWithMain()) textEditor->show();
insilmaril@0
   153
insilmaril@0
   154
	clipboardME = new MapEditor();
insilmaril@0
   155
	clipboardME->resize (800,600);
insilmaril@0
   156
	clipboardME->setCaption("VYM - clipboard");
insilmaril@0
   157
	clipboardME->hide();
insilmaril@0
   158
insilmaril@0
   159
	// Initialize mainwindow after Mapeditors (because of Flags)
insilmaril@0
   160
    Main m;
insilmaril@0
   161
	//m.resize(m.sizeHint());
insilmaril@0
   162
	m.setIcon (QPixmap (vym_logo_xpm));
insilmaril@0
   163
	m.show();
insilmaril@0
   164
	m.fileNew();
insilmaril@0
   165
	m.loadCmdLine();
insilmaril@0
   166
insilmaril@0
   167
	// For benchmarking we may want to quit immediatly after drawing
insilmaril@0
   168
	if (options.isOn ("quit"))
insilmaril@0
   169
	{
insilmaril@0
   170
		return 0;
insilmaril@0
   171
	}	
insilmaril@0
   172
insilmaril@0
   173
    QObject::connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
insilmaril@0
   174
insilmaril@0
   175
    return app.exec();
insilmaril@0
   176
}
insilmaril@0
   177