mainwindow.h
author insilmaril
Mon, 27 Apr 2009 12:07:15 +0000
changeset 756 a8a5c7288f57
parent 754 db0ec4bcf416
child 763 8c028a5d9083
permissions -rw-r--r--
relinking branches and removing branches works
     1 #ifndef MAINWINDOW_H 
     2 #define MAINWINDOW_H
     3 
     4 #include <QMainWindow>
     5 
     6 #include "branchpropwindow.h"
     7 #include "extrainfodialog.h"
     8 #include "file.h"
     9 #include "findwindow.h"
    10 #include "historywindow.h"
    11 #include "mapeditor.h"
    12 #include "simplescripteditor.h"
    13 #include "texteditor.h"
    14 #include "vymview.h"
    15 
    16 class Main : public QMainWindow 
    17 {
    18     Q_OBJECT
    19 
    20 public:
    21 	/*! Modifier modes are used when CTRL together with a mouse button is pressed */
    22 	enum ModMode {
    23 		ModModeNone,	//!< Unused
    24 		ModModeColor,	//!< Pick color from object
    25 		ModModeCopy,	//!< Copy object
    26 		ModModeXLink	//!< Create a XLink (XLinkObj) from selected object
    27 		};
    28 
    29     Main(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
    30     ~Main();
    31 	void loadCmdLine();
    32 
    33 private:
    34 	QProgressBar *progressBar;
    35 	int progressMax;
    36 	int progressMin;
    37 public:	
    38 	void statusMessage (const QString &);
    39 	void setProgressMinimum (int min);
    40 	void setProgressMaximum (int max);
    41 	void setProgressValue (int v);
    42 	void removeProgressBar();
    43 
    44 private:
    45 	VymView* createView (VymModel*);
    46 
    47 public slots:
    48     void fileNew();
    49     void fileNewCopy();
    50 
    51 protected:
    52 	void closeEvent( QCloseEvent* );
    53 
    54 private:
    55     void setupFileActions();
    56     void setupEditActions();
    57     void setupFormatActions();
    58     void setupViewActions();
    59     void setupModeActions();
    60     void setupWindowActions();
    61     void setupFlag(FlagObj *fo, QToolBar *tb, bool aw, const QString &name, const QString &tooltip);
    62     void setupFlagActions();
    63     void setupNetworkActions();
    64     void setupSettingsActions();
    65     void setupTestActions();
    66     void setupHelpActions();
    67     void setupContextMenus();
    68 	void setupRecentMapsMenu();
    69     void setupMacros();
    70 	void hideEvent (QHideEvent * );
    71 	void showEvent (QShowEvent * );
    72 	MapEditor* currentMapEditor() const;
    73 	VymModel* currentModel() const;
    74     
    75 private slots:
    76 	void editorChanged(QWidget*);
    77 
    78     ErrorCode fileLoad(QString ,const LoadMode &, const FileType & ftype=VymMap);
    79     void fileLoad(const LoadMode &);
    80     void fileLoad();
    81 	void fileLoadRecent();
    82 	void addRecentMap (const QString &);
    83     void fileSave(VymModel*, const SaveMode & );
    84     void fileSave();
    85 public slots:	
    86     void fileSave(VymModel*);	// autosave from MapEditor
    87 private slots:	
    88     void fileSaveAs(const SaveMode &);
    89     void fileSaveAs();
    90     void fileImportKDE3Bookmarks();
    91     void fileImportKDE4Bookmarks();
    92     void fileImportFirefoxBookmarks();
    93     void fileImportFreemind();
    94     void fileImportMM();
    95     void fileImportDir();
    96     void fileExportXML();
    97     void fileExportXHTML();
    98     void fileExportImage();
    99     void fileExportASCII();
   100     void fileExportCSV();
   101     void fileExportLaTeX();
   102     void fileExportKDE3Bookmarks();
   103     void fileExportKDE4Bookmarks();
   104     void fileExportTaskjuggler();
   105     void fileExportOOPresentation();
   106     void fileCloseMap();
   107     void filePrint();
   108     void fileExitVYM();
   109 
   110 public slots:
   111     void editUndo();	
   112     void editRedo();	
   113 	void gotoHistoryStep (int);
   114 private slots:	
   115     void editCopy();	
   116     void editPaste();	
   117     void editCut();	
   118     void editOpenFindWindow();
   119 	void editFind(QString);
   120 	void editFindChanged();
   121 private:
   122 	void openTabs(QStringList);
   123 public slots:
   124 	void editOpenURL();
   125 	void editOpenURLTab();
   126 private slots:
   127 	void editOpenMultipleURLTabs();
   128 	void editURL();
   129 	void editLocalURL();
   130 	void editHeading2URL();
   131 	void editBugzilla2URL();
   132 	void editFATE2URL();
   133 	void openVymLinks(const QStringList &);
   134 	void editVymLink();
   135 	void editOpenMultipleVymLinks();
   136     void editAttributeFinished();
   137 public slots:
   138     void editHeadingFinished(VymModel *m);
   139 //    void editHeading();
   140     void editAttribute();
   141 	void editOpenVymLink();
   142 private slots:
   143 	void editDeleteVymLink();
   144 	void editToggleHideExport();
   145 	void editMapInfo();
   146     void editMoveUp();	
   147     void editMoveDown();	
   148 	void editSortChildren();
   149     void editToggleScroll();
   150     void editUnscrollChildren();
   151     void editAddMapCenter();
   152     void editNewBranch();
   153     void editNewBranchBefore();
   154     void editNewBranchAbove();
   155     void editNewBranchBelow();
   156     void editImportAdd();
   157     void editImportReplace();
   158     void editSaveBranch();
   159     void editDeleteKeepChildren();
   160     void editDeleteChildren();
   161     void editDeleteSelection();
   162     void editUpperBranch();
   163     void editLowerBranch();
   164     void editLeftBranch();
   165     void editRightBranch();
   166     void editFirstBranch();
   167     void editLastBranch();
   168     void editLoadImage();
   169     void editSaveImage();
   170     void editFollowXLink (QAction *);
   171     void editEditXLink (QAction *);
   172 
   173     void formatSelectColor();
   174     void formatPickColor();
   175     void colorChanged(QColor);
   176     void formatColorBranch();
   177     void formatColorSubtree();
   178 	void formatLinkStyleLine();
   179 	void formatLinkStyleParabel();
   180 	void formatLinkStylePolyLine();
   181 	void formatLinkStylePolyParabel();
   182     void formatSelectBackColor();
   183     void formatSelectBackImage();
   184     void formatSelectLinkColor();
   185     void formatSelectSelectionColor();
   186     void formatToggleLinkColorHint();
   187 	void formatHideLinkUnselected();
   188 
   189     void viewZoomReset();
   190     void viewZoomIn();
   191     void viewZoomOut();
   192     void viewCenter();
   193 
   194 public slots:
   195 	void networkStartServer();
   196 	void networkConnect();
   197 	bool settingsPDF();
   198 	bool settingsURL();
   199 	void settingsMacroDir();
   200 	void settingsToggleDelKey();
   201 	void settingsUndoLevels();
   202 	void settingsAutosaveToggle();
   203 	void settingsAutosaveTime();
   204 	void settingsWriteBackupFileToggle();
   205 	void settingsToggleAnimation();
   206 
   207 	void windowToggleNoteEditor();
   208 	void windowToggleHistory();
   209 	void windowToggleProperty();
   210 	void updateHistory(SimpleSettings &);
   211 	void windowToggleAntiAlias();
   212 public:
   213 	bool isAliased();
   214 	bool hasSmoothPixmapTransform();
   215 public slots:
   216 	void windowToggleSmoothPixmap();
   217 	void updateNoteFlag();
   218 	void updateNoteEditor (QModelIndex index);
   219 	void changeSelection (VymModel *model,const QItemSelection &newSel, const QItemSelection &delSel);
   220 
   221 	void updateActions();
   222 	ModMode getModMode();
   223 	bool autoEditNewBranch();
   224 	bool autoSelectNewBranch();
   225 	bool useFlagGroups();
   226 	void setScript(const QString &);
   227 	void runScript(const QString &);
   228 	void runScriptEverywhere (const QString &);
   229 
   230 private slots:
   231 	void windowNextEditor();
   232 	void windowPreviousEditor();
   233 	void windowShowNoteEditor();
   234 	void windowHideNoteEditor();
   235 
   236 	void standardFlagChanged();
   237 
   238     void testFunction1();
   239     void testFunction2();
   240     void testCommand();
   241 
   242     void helpDoc();
   243     void helpDemo();
   244     void helpAbout();
   245     void helpAboutQT();
   246 
   247 	void callMacro ();
   248 
   249 private:
   250 	QTabWidget *tabWidget;
   251 	FindWindow *findWindow;
   252 	QProcess *procBrowser;
   253 
   254 	QStringList imageTypes;
   255 
   256 	QList <VymModel*> tabModel;		//!< the corresponding model to a tab
   257 
   258 	QString prevSelection;
   259 
   260 	HistoryWindow *historyWindow;
   261 
   262 	BranchPropertyWindow *branchPropertyWindow;
   263 	SimpleScriptEditor *scriptEditor;
   264 
   265 	QList <QAction*> actionListBranches;
   266 
   267 	QColor currentColor;
   268 
   269 	int xLinkMenuWidth;
   270 
   271 	QMenu *recentFilesMenu;
   272 	enum { MaxRecentFiles = 9 };
   273     QAction *recentFileActions[MaxRecentFiles];
   274 
   275     QAction *macroActions[12];
   276 	QStringList macro;
   277 
   278 	QAction* actionFileNewCopy;
   279 	QAction* actionFileSave;
   280 	QAction* actionFilePrint;
   281 	QAction* actionUndo;
   282 	QAction* actionRedo;
   283 	QAction *actionCopy;
   284 	QAction *actionCut;
   285 	QAction *actionPaste;
   286 	QAction *actionMoveUp;
   287 	QAction *actionMoveDown;
   288 	QAction *actionSortChildren;
   289 	QAction *actionToggleScroll;
   290 	QAction* actionOpenURL;
   291 	QAction* actionOpenURLTab;
   292 	QAction* actionOpenMultipleURLTabs;
   293 	QAction* actionURL;
   294 	QAction* actionLocalURL;
   295 	QAction* actionHeading2URL;
   296 	QAction* actionBugzilla2URL;
   297 	QAction* actionFATE2URL;
   298 	QAction *actionOpenVymLink;
   299 	QAction *actionOpenMultipleVymLinks;
   300 	QAction *actionVymLink;
   301 	QAction *actionDeleteVymLink;
   302 	QAction *actionToggleHideExport;
   303 	QAction *actionMapInfo;
   304 	QAction *actionHeading;
   305 	QAction *actionDelete;
   306 
   307 public:
   308 	QAction *actionAddMapCenter;
   309 
   310 private:	
   311 	QAction *actionAddBranch;
   312 	QAction *actionAddBranchBefore;
   313 	QAction *actionAddBranchAbove;
   314 	QAction *actionAddBranchBelow;
   315 	QAction *actionDeleteKeepChildren;
   316 	QAction *actionDeleteChildren;
   317 	QAction *actionImportAdd;
   318 	QAction *actionImportReplace;
   319 	QAction *actionSaveBranch;
   320 	QAction *actionSelectFirst;
   321 	QAction *actionSelectLast;
   322 	QAction *actionLoadImage;
   323 
   324 	QAction* actionFormatColor;
   325 	QAction* actionFormatPickColor;
   326 	QAction* actionFormatColorBranch;
   327 	QAction* actionFormatColorSubtree;
   328 	QAction* actionFormatLinkColorHint;
   329 	QAction* actionFormatBackColor;
   330 	QAction* actionFormatBackImage;
   331 	QAction* actionFormatLinkColor;
   332 	QAction* actionFormatSelectionColor;
   333 
   334 	QActionGroup* actionGroupModModes;
   335 	QAction* actionModModeColor;
   336 	QAction* actionModModeXLink;
   337 	QAction* actionModModeCopy;
   338 
   339 	QActionGroup *actionGroupFormatFrameTypes;
   340 
   341 
   342 	QActionGroup *actionGroupFormatLinkStyles;
   343 	QAction *actionFormatLinkStyleLine;
   344 	QAction *actionFormatLinkStyleParabel;
   345 	QAction *actionFormatLinkStylePolyLine;
   346 	QAction *actionFormatLinkStylePolyParabel;
   347 	QAction *actionFormatHideLinkUnselected;
   348 
   349 	QAction *actionViewToggleNoteEditor;
   350 	QAction *actionViewToggleHistoryWindow;
   351 	QAction *actionViewTogglePropertyWindow;
   352 	QAction *actionViewToggleAntiAlias;
   353 	QAction *actionViewToggleSmoothPixmapTransform;
   354 	QAction* actionViewCenter;
   355 
   356 	QAction* actionSettingsAutoEditNewBranch;
   357 	QAction* actionSettingsAutoSelectNewBranch;
   358 	QAction* actionSettingsAutoSelectText;
   359 	QAction* actionSettingsUseDelKey;
   360 	QAction* actionSettingsUseFlagGroups;
   361 	QAction* actionSettingsUseHideExport;
   362 	QAction* actionSettingsAutosaveToggle;
   363 	QAction* actionSettingsAutosaveTime;
   364 	QAction* actionSettingsWriteBackupFile;
   365 	QAction* actionSettingsUseAnimation;
   366 };
   367 
   368 
   369 #endif
   370