mainwindow.h
author insilmaril
Wed, 13 May 2009 08:26:27 +0000
changeset 767 6d2b32f305f9
parent 763 8c028a5d9083
child 769 a6931cd6309a
permissions -rw-r--r--
Started to use QtKinetic for Animation
     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 private:
    46 	VymView* createView (VymModel*);
    47 
    48 public slots:
    49     void fileNew();
    50     void fileNewCopy();
    51 
    52 protected:
    53 	void closeEvent( QCloseEvent* );
    54 
    55 private:
    56     void setupFileActions();
    57     void setupEditActions();
    58     void setupFormatActions();
    59     void setupViewActions();
    60     void setupModeActions();
    61     void setupWindowActions();
    62     void setupFlag(Flag *flag, QToolBar *tb, const QString &name, const QString &tooltip);
    63     void setupFlagActions();
    64     void setupNetworkActions();
    65     void setupSettingsActions();
    66     void setupTestActions();
    67     void setupHelpActions();
    68     void setupContextMenus();
    69 	void setupRecentMapsMenu();
    70     void setupMacros();
    71 	void hideEvent (QHideEvent * );
    72 	void showEvent (QShowEvent * );
    73 	MapEditor* currentMapEditor() const;
    74 	VymModel* currentModel() const;
    75     
    76 private slots:
    77 	void editorChanged(QWidget*);
    78 
    79     ErrorCode fileLoad(QString ,const LoadMode &, const FileType & ftype=VymMap);
    80     void fileLoad(const LoadMode &);
    81     void fileLoad();
    82 	void fileLoadRecent();
    83 	void addRecentMap (const QString &);
    84     void fileSave(VymModel*, const SaveMode & );
    85     void fileSave();
    86 public slots:	
    87     void fileSave(VymModel*);	// autosave from MapEditor
    88 private slots:	
    89     void fileSaveAs(const SaveMode &);
    90     void fileSaveAs();
    91     void fileImportKDE3Bookmarks();
    92     void fileImportKDE4Bookmarks();
    93     void fileImportFirefoxBookmarks();
    94     void fileImportFreemind();
    95     void fileImportMM();
    96     void fileImportDir();
    97     void fileExportXML();
    98     void fileExportXHTML();
    99     void fileExportImage();
   100     void fileExportASCII();
   101     void fileExportCSV();
   102     void fileExportLaTeX();
   103     void fileExportKDE3Bookmarks();
   104     void fileExportKDE4Bookmarks();
   105     void fileExportTaskjuggler();
   106     void fileExportOOPresentation();
   107     void fileCloseMap();
   108     void filePrint();
   109     void fileExitVYM();
   110 
   111 public slots:
   112     void editUndo();	
   113     void editRedo();	
   114 	void gotoHistoryStep (int);
   115 private slots:	
   116     void editCopy();	
   117     void editPaste();	
   118     void editCut();	
   119     void editOpenFindWindow();
   120 	void editFind(QString);
   121 	void editFindChanged();
   122 private:
   123 	void openTabs(QStringList);
   124 public slots:
   125 	void editOpenURL();
   126 	void editOpenURLTab();
   127 private slots:
   128 	void editOpenMultipleURLTabs();
   129 	void editURL();
   130 	void editLocalURL();
   131 	void editHeading2URL();
   132 	void editBugzilla2URL();
   133 	void editFATE2URL();
   134 	void openVymLinks(const QStringList &);
   135 	void editVymLink();
   136 	void editOpenMultipleVymLinks();
   137 public slots:
   138     void editHeadingFinished(VymModel *m);
   139 //    void editHeading();
   140 	void editOpenVymLink();
   141 private slots:
   142 	void editDeleteVymLink();
   143 	void editToggleHideExport();
   144 	void editMapInfo();
   145     void editMoveUp();	
   146     void editMoveDown();	
   147 	void editSortChildren();
   148     void editToggleScroll();
   149     void editExpandAll();
   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 	void setScript(const QString &);
   226 	void runScript(const QString &);
   227 	void runScriptEverywhere (const QString &);
   228 
   229 private slots:
   230 	void windowNextEditor();
   231 	void windowPreviousEditor();
   232 	void windowShowNoteEditor();
   233 	void windowHideNoteEditor();
   234 
   235 	void standardFlagChanged();
   236 
   237     void testFunction1();
   238     void testFunction2();
   239     void testCommand();
   240 
   241     void helpDoc();
   242     void helpDemo();
   243     void helpAbout();
   244     void helpAboutQT();
   245 
   246 	void callMacro ();
   247 
   248 private:
   249 	QTabWidget *tabWidget;
   250 	FindWindow *findWindow;
   251 	QProcess *procBrowser;
   252 
   253 	QStringList imageTypes;
   254 
   255 	QList <VymModel*> tabModel;		//!< the corresponding model to a tab
   256 
   257 	QString prevSelection;
   258 
   259 	HistoryWindow *historyWindow;
   260 
   261 	BranchPropertyWindow *branchPropertyWindow;
   262 	SimpleScriptEditor *scriptEditor;
   263 
   264 	QList <QAction*> actionListBranches;
   265 
   266 	QColor currentColor;
   267 
   268 	int xLinkMenuWidth;
   269 
   270 	QMenu *recentFilesMenu;
   271 	enum { MaxRecentFiles = 9 };
   272     QAction *recentFileActions[MaxRecentFiles];
   273 
   274     QAction *macroActions[12];
   275 	QStringList macro;
   276 
   277 	QAction* actionFileNewCopy;
   278 	QAction* actionFileSave;
   279 	QAction* actionFilePrint;
   280 	QAction* actionUndo;
   281 	QAction* actionRedo;
   282 	QAction *actionCopy;
   283 	QAction *actionCut;
   284 	QAction *actionPaste;
   285 	QAction *actionMoveUp;
   286 	QAction *actionMoveDown;
   287 	QAction *actionSortChildren;
   288 	QAction *actionToggleScroll;
   289 	QAction *actionExpandAll;
   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