mainwindow.h
author insilmaril
Tue, 06 May 2008 10:24:29 +0000
changeset 699 0b143f52a062
parent 690 3bb6b1548c53
child 721 12958f987bcf
permissions -rw-r--r--
Version 1.12.0
     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 editAddMapCenter();
   135     void editNewBranch();
   136     void editNewBranchBefore();
   137     void editNewBranchAbove();
   138     void editNewBranchBelow();
   139     void editImportAdd();
   140     void editImportReplace();
   141     void editSaveBranch();
   142     void editDeleteKeepChilds();
   143     void editDeleteChilds();
   144     void editDeleteSelection();
   145     void editUpperBranch();
   146     void editLowerBranch();
   147     void editLeftBranch();
   148     void editRightBranch();
   149     void editFirstBranch();
   150     void editLastBranch();
   151     void editLoadImage();
   152     void editSaveImage();
   153     void editFollowXLink (QAction *);
   154     void editEditXLink (QAction *);
   155 
   156     void formatSelectColor();
   157     void formatPickColor();
   158     void colorChanged(QColor);
   159     void formatColorBranch();
   160     void formatColorSubtree();
   161 	void formatLinkStyleLine();
   162 	void formatLinkStyleParabel();
   163 	void formatLinkStylePolyLine();
   164 	void formatLinkStylePolyParabel();
   165     void formatSelectBackColor();
   166     void formatSelectBackImage();
   167     void formatSelectLinkColor();
   168     void formatSelectSelectionColor();
   169     void formatToggleLinkColorHint();
   170 	void formatHideLinkUnselected();
   171 
   172     void viewZoomReset();
   173     void viewZoomIn();
   174     void viewZoomOut();
   175     void viewCenter();
   176 
   177 public slots:
   178 	void networkStartServer();
   179 	void networkConnect();
   180 	bool settingsPDF();
   181 	bool settingsURL();
   182 	void settingsMacroDir();
   183 	void settingsToggleDelKey();
   184 	void settingsUndoLevels();
   185 	void settingsAutosaveToggle();
   186 	void settingsAutosaveTime();
   187 	void settingsWriteBackupFileToggle();
   188 	void settingsToggleAnimation();
   189 
   190 	void windowToggleNoteEditor();
   191 	void windowToggleHistory();
   192 	void windowToggleProperty();
   193 	void updateHistory(SimpleSettings &);
   194 	void windowToggleAntiAlias();
   195 	void windowToggleSmoothPixmap();
   196 	void updateNoteFlag();
   197 	void updateSatellites(MapEditor *);
   198 	void updateActions();
   199 	ModMode getModMode();
   200 	bool autoEditNewBranch();
   201 	bool autoSelectNewBranch();
   202 	bool useFlagGroups();
   203 	void setScript(const QString &);
   204 	void runScript(const QString &);
   205 	void runScriptEverywhere (const QString &);
   206 
   207 private slots:
   208 	void windowNextEditor();
   209 	void windowPreviousEditor();
   210 	void windowShowNoteEditor();
   211 	void windowHideNoteEditor();
   212 
   213 	void standardFlagChanged();
   214 
   215     void testFunction1();
   216     void testFunction2();
   217     void testCommand();
   218 
   219     void helpDoc();
   220     void helpDemo();
   221     void helpAbout();
   222     void helpAboutQT();
   223 
   224 	void callMacro ();
   225 
   226 private:
   227 	QTabWidget *tabWidget;
   228 	FindWindow *findWindow;
   229 	QProcess *procBrowser;
   230 
   231 	QStringList imageTypes;
   232 
   233 	QLineEdit *lineedit;	// to enter headings of branches
   234 	QString prevSelection;
   235 
   236 	HistoryWindow *historyWindow;
   237 
   238 	BranchPropertyWindow *branchPropertyWindow;
   239 	SimpleScriptEditor *scriptEditor;
   240 
   241 	QList <QAction*> actionListBranches;
   242 
   243 	QColor currentColor;
   244 
   245 	int xLinkMenuWidth;
   246 
   247 	QMenu *recentFilesMenu;
   248 	enum { MaxRecentFiles = 9 };
   249     QAction *recentFileActions[MaxRecentFiles];
   250 
   251     QAction *macroActions[12];
   252 	QStringList macro;
   253 
   254 	QAction* actionFileNewCopy;
   255 	QAction* actionFileSave;
   256 	QAction* actionFilePrint;
   257 	QAction* actionEditUndo;
   258 	QAction* actionEditRedo;
   259 	QAction *actionEditCopy;
   260 	QAction *actionEditCut;
   261 	QAction *actionEditPaste;
   262 	QAction *actionEditMoveUp;
   263 	QAction *actionEditMoveDown;
   264 	QAction *actionEditSortChildren;
   265 	QAction *actionEditToggleScroll;
   266 	QAction* actionEditOpenURL;
   267 	QAction* actionEditOpenURLTab;
   268 	QAction* actionEditOpenMultipleURLTabs;
   269 	QAction* actionEditURL;
   270 	QAction* actionEditLocalURL;
   271 	QAction* actionEditHeading2URL;
   272 	QAction* actionEditBugzilla2URL;
   273 	QAction* actionEditFATE2URL;
   274 	QAction *actionEditOpenVymLink;
   275 	QAction *actionEditOpenMultipleVymLinks;
   276 	QAction *actionEditVymLink;
   277 	QAction *actionEditDeleteVymLink;
   278 	QAction *actionEditToggleHideExport;
   279 	QAction *actionEditMapInfo;
   280 	QAction *actionEditHeading;
   281 	QAction *actionEditDelete;
   282 	QAction *actionEditAddMapCenter;
   283 	QAction *actionEditAddBranch;
   284 	QAction *actionEditAddBranchBefore;
   285 	QAction *actionEditAddBranchAbove;
   286 	QAction *actionEditAddBranchBelow;
   287 	QAction *actionEditDeleteKeepChilds;
   288 	QAction *actionEditDeleteChilds;
   289 	QAction *actionEditImportAdd;
   290 	QAction *actionEditImportReplace;
   291 	QAction *actionEditSaveBranch;
   292 	QAction *actionEditSelectFirst;
   293 	QAction *actionEditSelectLast;
   294 	QAction *actionEditLoadImage;
   295 
   296 	QAction* actionFormatColor;
   297 	QAction* actionFormatPickColor;
   298 	QAction* actionFormatColorBranch;
   299 	QAction* actionFormatColorSubtree;
   300 	QAction* actionFormatLinkColorHint;
   301 	QAction* actionFormatBackColor;
   302 	QAction* actionFormatBackImage;
   303 	QAction* actionFormatLinkColor;
   304 	QAction* actionFormatSelectionColor;
   305 
   306 	QActionGroup* actionGroupModModes;
   307 	QAction* actionModModeColor;
   308 	QAction* actionModModeXLink;
   309 	QAction* actionModModeCopy;
   310 
   311 	QActionGroup *actionGroupFormatFrameTypes;
   312 
   313 
   314 	QActionGroup *actionGroupFormatLinkStyles;
   315 	QAction *actionFormatLinkStyleLine;
   316 	QAction *actionFormatLinkStyleParabel;
   317 	QAction *actionFormatLinkStylePolyLine;
   318 	QAction *actionFormatLinkStylePolyParabel;
   319 	QAction *actionFormatHideLinkUnselected;
   320 
   321 	QAction *actionViewToggleNoteEditor;
   322 	QAction *actionViewToggleHistoryWindow;
   323 	QAction *actionViewTogglePropertyWindow;
   324 	QAction *actionViewToggleAntiAlias;
   325 	QAction *actionViewToggleSmoothPixmapTransform;
   326 	QAction* actionViewCenter;
   327 
   328 	QAction* actionSettingsAutoEditNewBranch;
   329 	QAction* actionSettingsAutoSelectNewBranch;
   330 	QAction* actionSettingsAutoSelectText;
   331 	QAction* actionSettingsUseDelKey;
   332 	QAction* actionSettingsUseFlagGroups;
   333 	QAction* actionSettingsUseHideExport;
   334 	QAction* actionSettingsAutosaveToggle;
   335 	QAction* actionSettingsAutosaveTime;
   336 	QAction* actionSettingsWriteBackupFile;
   337 	QAction* actionSettingsUseAnimation;
   338 };
   339 
   340 
   341 #endif
   342