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