mainwindow.h
author insilmaril
Mon Jan 14 16:26:59 2008 +0000 (2008-01-14)
changeset 641 687833b29c4e
parent 616 16d63fc9ae42
child 684 5f9a2771680d
permissions -rw-r--r--
Added french manual by Claude
     1 #ifndef MAINWINDOW_H 
     2 #define MAINWINDOW_H
     3 
     4 #include <QMainWindow>
     5 
     6 #include "branchpropwindow.h"
     7 #include "file.h"
     8 #include "findwindow.h"
     9 #include "historywindow.h"
    10 #include "mapeditor.h"
    11 #include "simplescripteditor.h"
    12 #include "texteditor.h"
    13 
    14 
    15 class Main : public QMainWindow 
    16 {
    17     Q_OBJECT
    18 
    19 public:
    20 	/*! Modifier modes are used when CTRL together with a mouse button is pressed */
    21 	enum ModMode {
    22 		ModModeNone,	//!< Unused
    23 		ModModeColor,	//!< Pick color from object
    24 		ModModeCopy,	//!< Copy object
    25 		ModModeXLink	//!< Create a XLink (XLinkObj) from selected object
    26 		};
    27 
    28     Main(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
    29     ~Main();
    30 	void loadCmdLine();
    31 	void statusMessage (const QString &);
    32 
    33 public slots:
    34     void fileNew();
    35     void fileNewCopy();
    36 
    37 protected:
    38 	void closeEvent( QCloseEvent* );
    39 
    40 private:
    41     void setupFileActions();
    42     void setupEditActions();
    43     void setupFormatActions();
    44     void setupViewActions();
    45     void setupModeActions();
    46     void setupWindowActions();
    47     void setupFlag(FlagObj *fo, QToolBar *tb, bool aw, const QString &name, const QString &tooltip);
    48     void setupFlagActions();
    49     void setupNetworkActions();
    50     void setupSettingsActions();
    51     void setupTestActions();
    52     void setupHelpActions();
    53     void setupContextMenus();
    54 	void setupRecentMapsMenu();
    55     void setupMacros();
    56 	void hideEvent (QHideEvent * );
    57 	void showEvent (QShowEvent * );
    58 	MapEditor* currentMapEditor() const;
    59     
    60 private slots:
    61 	void editorChanged(QWidget*);
    62 
    63     ErrorCode fileLoad(QString ,const LoadMode &, const FileType & ftype=VymMap);
    64     void fileLoad(const LoadMode &);
    65     void fileLoad();
    66 	void fileLoadRecent();
    67 	void addRecentMap (const QString &);
    68     void fileSave(MapEditor*, const SaveMode & );
    69     void fileSave();
    70 public slots:	
    71     void fileSave(MapEditor *);	// autosave from MapEditor
    72 private slots:	
    73     void fileSaveAs(const SaveMode &);
    74     void fileSaveAs();
    75     void fileImportKDEBookmarks();
    76     void fileImportFirefoxBookmarks();
    77     void fileImportFreemind();
    78     void fileImportMM();
    79     void fileImportDir();
    80     void fileExportXML();
    81     void fileExportXHTML();
    82     void fileExportImage();
    83     void fileExportASCII();
    84     void fileExportCSV();
    85     void fileExportLaTeX();
    86     void fileExportKDEBookmarks();
    87     void fileExportTaskjuggler();
    88     void fileExportOOPresentation();
    89     void fileCloseMap();
    90     void filePrint();
    91     void fileExitVYM();
    92 
    93 public slots:
    94     void editUndo();	
    95     void editRedo();	
    96 	void gotoHistoryStep (int);
    97 private slots:	
    98     void editCopy();	
    99     void editPaste();	
   100     void editCut();	
   101     void editOpenFindWindow();
   102 	void editFind(QString);
   103 	void editFindChanged();
   104 private:
   105 	void openTabs(QStringList);
   106 public slots:
   107 	void editOpenURL();
   108 	void editOpenURLTab();
   109 private slots:
   110 	void editOpenMultipleURLTabs();
   111 	void editURL();
   112 	void editLocalURL();
   113 	void editHeading2URL();
   114 	void editBugzilla2URL();
   115 	void editFATE2URL();
   116 	void openVymLinks(const QStringList &);
   117 	void editVymLink();
   118 	void editOpenMultipleVymLinks();
   119     void editHeadingFinished();
   120     void editAttributeFinished();
   121 public slots:
   122     void editHeading();
   123     void editAttribute();
   124 	void editOpenVymLink();
   125 private slots:
   126 	void editDeleteVymLink();
   127 	void editToggleHideExport();
   128 	void editMapInfo();
   129     void editMoveUp();	
   130     void editMoveDown();	
   131 	void editSortChildren();
   132     void editToggleScroll();
   133     void editUnscrollChilds();
   134     void editNewBranch();
   135     void editNewBranchBefore();
   136     void editNewBranchAbove();
   137     void editNewBranchBelow();
   138     void editImportAdd();
   139     void editImportReplace();
   140     void editSaveBranch();
   141     void editDeleteKeepChilds();
   142     void editDeleteChilds();
   143     void editDeleteSelection();
   144     void editUpperBranch();
   145     void editLowerBranch();
   146     void editLeftBranch();
   147     void editRightBranch();
   148     void editFirstBranch();
   149     void editLastBranch();
   150     void editLoadImage();
   151     void editSaveImage();
   152     void editFollowXLink (QAction *);
   153     void editEditXLink (QAction *);
   154 
   155     void formatSelectColor();
   156     void formatPickColor();
   157     void colorChanged(QColor);
   158     void formatColorBranch();
   159     void formatColorSubtree();
   160 	void formatLinkStyleLine();
   161 	void formatLinkStyleParabel();
   162 	void formatLinkStylePolyLine();
   163 	void formatLinkStylePolyParabel();
   164     void formatSelectBackColor();
   165     void formatSelectBackImage();
   166     void formatSelectLinkColor();
   167     void formatSelectSelectionColor();
   168     void formatToggleLinkColorHint();
   169 	void formatHideLinkUnselected();
   170 
   171     void viewZoomReset();
   172     void viewZoomIn();
   173     void viewZoomOut();
   174     void viewCenter();
   175 
   176 public slots:
   177 	void networkStartServer();
   178 	void networkConnect();
   179 	bool settingsPDF();
   180 	bool settingsURL();
   181 	void settingsMacroDir();
   182 	void settingsToggleDelKey();
   183 	void settingsUndoLevels();
   184 	void settingsAutosaveToggle();
   185 	void settingsAutosaveTime();
   186 	void settingsWriteBackupFileToggle();
   187 
   188 	void windowToggleNoteEditor();
   189 	void windowToggleHistory();
   190 	void windowToggleProperty();
   191 	void updateHistory(SimpleSettings &);
   192 	void windowToggleAntiAlias();
   193 	void windowToggleSmoothPixmap();
   194 	void updateNoteFlag();
   195 	void updateSatellites(MapEditor *);
   196 	void updateActions();
   197 	ModMode getModMode();
   198 	bool autoEditNewBranch();
   199 	bool autoSelectNewBranch();
   200 	bool useFlagGroups();
   201 	void setScript(const QString &);
   202 	void runScript(const QString &);
   203 	void runScriptEverywhere (const QString &);
   204 
   205 private slots:
   206 	void windowNextEditor();
   207 	void windowPreviousEditor();
   208 	void windowShowNoteEditor();
   209 	void windowHideNoteEditor();
   210 
   211 	void standardFlagChanged();
   212 
   213     void testFunction1();
   214     void testFunction2();
   215     void testCommand();
   216 
   217     void helpDoc();
   218     void helpDemo();
   219     void helpAbout();
   220     void helpAboutQT();
   221 
   222 	void callMacro ();
   223 
   224 private:
   225 	QTabWidget *tabWidget;
   226 	FindWindow *findWindow;
   227 	QProcess *procBrowser;
   228 
   229 	QStringList imageTypes;
   230 
   231 	QLineEdit *lineedit;	// to enter headings of branches
   232 	QString prevSelection;
   233 
   234 	HistoryWindow *historyWindow;
   235 
   236 	BranchPropertyWindow *branchPropertyWindow;
   237 	SimpleScriptEditor *scriptEditor;
   238 
   239 	QList <QAction*> actionListBranches;
   240 
   241 	QColor currentColor;
   242 
   243 	int xLinkMenuWidth;
   244 
   245 	QMenu *recentFilesMenu;
   246 	enum { MaxRecentFiles = 9 };
   247     QAction *recentFileActions[MaxRecentFiles];
   248 
   249     QAction *macroActions[12];
   250 	QStringList macro;
   251 
   252 	QAction* actionFileSave;
   253 	QAction* actionFilePrint;
   254 	QAction* actionEditUndo;
   255 	QAction* actionEditRedo;
   256 	QAction *actionEditCopy;
   257 	QAction *actionEditCut;
   258 	QAction *actionEditPaste;
   259 	QAction *actionEditMoveUp;
   260 	QAction *actionEditMoveDown;
   261 	QAction *actionEditSortChildren;
   262 	QAction *actionEditToggleScroll;
   263 	QAction* actionEditOpenURL;
   264 	QAction* actionEditOpenURLTab;
   265 	QAction* actionEditOpenMultipleURLTabs;
   266 	QAction* actionEditURL;
   267 	QAction* actionEditLocalURL;
   268 	QAction* actionEditHeading2URL;
   269 	QAction* actionEditBugzilla2URL;
   270 	QAction* actionEditFATE2URL;
   271 	QAction *actionEditOpenVymLink;
   272 	QAction *actionEditOpenMultipleVymLinks;
   273 	QAction *actionEditVymLink;
   274 	QAction *actionEditDeleteVymLink;
   275 	QAction *actionEditToggleHideExport;
   276 	QAction *actionEditMapInfo;
   277 	QAction *actionEditHeading;
   278 	QAction *actionEditDelete;
   279 	QAction *actionEditAddBranch;
   280 	QAction *actionEditAddBranchBefore;
   281 	QAction *actionEditAddBranchAbove;
   282 	QAction *actionEditAddBranchBelow;
   283 	QAction *actionEditDeleteKeepChilds;
   284 	QAction *actionEditDeleteChilds;
   285 	QAction *actionEditImportAdd;
   286 	QAction *actionEditImportReplace;
   287 	QAction *actionEditSaveBranch;
   288 	QAction *actionEditSelectFirst;
   289 	QAction *actionEditSelectLast;
   290 	QAction *actionEditLoadImage;
   291 
   292 	QAction* actionFormatColor;
   293 	QAction* actionFormatPickColor;
   294 	QAction* actionFormatColorBranch;
   295 	QAction* actionFormatColorSubtree;
   296 	QAction* actionFormatLinkColorHint;
   297 	QAction* actionFormatBackColor;
   298 	QAction* actionFormatBackImage;
   299 	QAction* actionFormatLinkColor;
   300 	QAction* actionFormatSelectionColor;
   301 
   302 	QActionGroup* actionGroupModModes;
   303 	QAction* actionModModeColor;
   304 	QAction* actionModModeXLink;
   305 	QAction* actionModModeCopy;
   306 
   307 	QActionGroup *actionGroupFormatFrameTypes;
   308 
   309 
   310 	QActionGroup *actionGroupFormatLinkStyles;
   311 	QAction *actionFormatLinkStyleLine;
   312 	QAction *actionFormatLinkStyleParabel;
   313 	QAction *actionFormatLinkStylePolyLine;
   314 	QAction *actionFormatLinkStylePolyParabel;
   315 	QAction *actionFormatHideLinkUnselected;
   316 
   317 	QAction *actionViewToggleNoteEditor;
   318 	QAction *actionViewToggleHistoryWindow;
   319 	QAction *actionViewTogglePropertyWindow;
   320 	QAction *actionViewToggleAntiAlias;
   321 	QAction *actionViewToggleSmoothPixmapTransform;
   322 	QAction* actionViewCenter;
   323 
   324 	QAction* actionSettingsAutoEditNewBranch;
   325 	QAction* actionSettingsAutoSelectNewBranch;
   326 	QAction* actionSettingsAutoSelectText;
   327 	QAction* actionSettingsUseDelKey;
   328 	QAction* actionSettingsUseFlagGroups;
   329 	QAction* actionSettingsUseHideExport;
   330 	QAction* actionSettingsAutosaveToggle;
   331 	QAction* actionSettingsAutosaveTime;
   332 	QAction* actionSettingsWriteBackupFile;
   333 };
   334 
   335 
   336 #endif
   337