mainwindow.h
author insilmaril
Thu, 07 May 2009 08:48:53 +0000
changeset 766 7a71a914afdb
parent 763 8c028a5d9083
child 767 6d2b32f305f9
permissions -rw-r--r--
Started to reanimate flags
     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 editExpandAll();
   151     void editUnscrollChildren();
   152     void editAddMapCenter();
   153     void editNewBranch();
   154     void editNewBranchBefore();
   155     void editNewBranchAbove();
   156     void editNewBranchBelow();
   157     void editImportAdd();
   158     void editImportReplace();
   159     void editSaveBranch();
   160     void editDeleteKeepChildren();
   161     void editDeleteChildren();
   162     void editDeleteSelection();
   163     void editUpperBranch();
   164     void editLowerBranch();
   165     void editLeftBranch();
   166     void editRightBranch();
   167     void editFirstBranch();
   168     void editLastBranch();
   169     void editLoadImage();
   170     void editSaveImage();
   171     void editFollowXLink (QAction *);
   172     void editEditXLink (QAction *);
   173 
   174     void formatSelectColor();
   175     void formatPickColor();
   176     void colorChanged(QColor);
   177     void formatColorBranch();
   178     void formatColorSubtree();
   179 	void formatLinkStyleLine();
   180 	void formatLinkStyleParabel();
   181 	void formatLinkStylePolyLine();
   182 	void formatLinkStylePolyParabel();
   183     void formatSelectBackColor();
   184     void formatSelectBackImage();
   185     void formatSelectLinkColor();
   186     void formatSelectSelectionColor();
   187     void formatToggleLinkColorHint();
   188 	void formatHideLinkUnselected();
   189 
   190     void viewZoomReset();
   191     void viewZoomIn();
   192     void viewZoomOut();
   193     void viewCenter();
   194 
   195 public slots:
   196 	void networkStartServer();
   197 	void networkConnect();
   198 	bool settingsPDF();
   199 	bool settingsURL();
   200 	void settingsMacroDir();
   201 	void settingsToggleDelKey();
   202 	void settingsUndoLevels();
   203 	void settingsAutosaveToggle();
   204 	void settingsAutosaveTime();
   205 	void settingsWriteBackupFileToggle();
   206 	void settingsToggleAnimation();
   207 
   208 	void windowToggleNoteEditor();
   209 	void windowToggleHistory();
   210 	void windowToggleProperty();
   211 	void updateHistory(SimpleSettings &);
   212 	void windowToggleAntiAlias();
   213 public:
   214 	bool isAliased();
   215 	bool hasSmoothPixmapTransform();
   216 public slots:
   217 	void windowToggleSmoothPixmap();
   218 	void updateNoteFlag();
   219 	void updateNoteEditor (QModelIndex index);
   220 	void changeSelection (VymModel *model,const QItemSelection &newSel, const QItemSelection &delSel);
   221 
   222 	void updateActions();
   223 	ModMode getModMode();
   224 	bool autoEditNewBranch();
   225 	bool autoSelectNewBranch();
   226 	bool useFlagGroups();
   227 	void setScript(const QString &);
   228 	void runScript(const QString &);
   229 	void runScriptEverywhere (const QString &);
   230 
   231 private slots:
   232 	void windowNextEditor();
   233 	void windowPreviousEditor();
   234 	void windowShowNoteEditor();
   235 	void windowHideNoteEditor();
   236 
   237 	void standardFlagChanged();
   238 
   239     void testFunction1();
   240     void testFunction2();
   241     void testCommand();
   242 
   243     void helpDoc();
   244     void helpDemo();
   245     void helpAbout();
   246     void helpAboutQT();
   247 
   248 	void callMacro ();
   249 
   250 private:
   251 	QTabWidget *tabWidget;
   252 	FindWindow *findWindow;
   253 	QProcess *procBrowser;
   254 
   255 	QStringList imageTypes;
   256 
   257 	QList <VymModel*> tabModel;		//!< the corresponding model to a tab
   258 
   259 	QString prevSelection;
   260 
   261 	HistoryWindow *historyWindow;
   262 
   263 	BranchPropertyWindow *branchPropertyWindow;
   264 	SimpleScriptEditor *scriptEditor;
   265 
   266 	QList <QAction*> actionListBranches;
   267 
   268 	QColor currentColor;
   269 
   270 	int xLinkMenuWidth;
   271 
   272 	QMenu *recentFilesMenu;
   273 	enum { MaxRecentFiles = 9 };
   274     QAction *recentFileActions[MaxRecentFiles];
   275 
   276     QAction *macroActions[12];
   277 	QStringList macro;
   278 
   279 	QAction* actionFileNewCopy;
   280 	QAction* actionFileSave;
   281 	QAction* actionFilePrint;
   282 	QAction* actionUndo;
   283 	QAction* actionRedo;
   284 	QAction *actionCopy;
   285 	QAction *actionCut;
   286 	QAction *actionPaste;
   287 	QAction *actionMoveUp;
   288 	QAction *actionMoveDown;
   289 	QAction *actionSortChildren;
   290 	QAction *actionToggleScroll;
   291 	QAction *actionExpandAll;
   292 	QAction* actionOpenURL;
   293 	QAction* actionOpenURLTab;
   294 	QAction* actionOpenMultipleURLTabs;
   295 	QAction* actionURL;
   296 	QAction* actionLocalURL;
   297 	QAction* actionHeading2URL;
   298 	QAction* actionBugzilla2URL;
   299 	QAction* actionFATE2URL;
   300 	QAction *actionOpenVymLink;
   301 	QAction *actionOpenMultipleVymLinks;
   302 	QAction *actionVymLink;
   303 	QAction *actionDeleteVymLink;
   304 	QAction *actionToggleHideExport;
   305 	QAction *actionMapInfo;
   306 	QAction *actionHeading;
   307 	QAction *actionDelete;
   308 
   309 public:
   310 	QAction *actionAddMapCenter;
   311 
   312 private:	
   313 	QAction *actionAddBranch;
   314 	QAction *actionAddBranchBefore;
   315 	QAction *actionAddBranchAbove;
   316 	QAction *actionAddBranchBelow;
   317 	QAction *actionDeleteKeepChildren;
   318 	QAction *actionDeleteChildren;
   319 	QAction *actionImportAdd;
   320 	QAction *actionImportReplace;
   321 	QAction *actionSaveBranch;
   322 	QAction *actionSelectFirst;
   323 	QAction *actionSelectLast;
   324 	QAction *actionLoadImage;
   325 
   326 	QAction* actionFormatColor;
   327 	QAction* actionFormatPickColor;
   328 	QAction* actionFormatColorBranch;
   329 	QAction* actionFormatColorSubtree;
   330 	QAction* actionFormatLinkColorHint;
   331 	QAction* actionFormatBackColor;
   332 	QAction* actionFormatBackImage;
   333 	QAction* actionFormatLinkColor;
   334 	QAction* actionFormatSelectionColor;
   335 
   336 	QActionGroup* actionGroupModModes;
   337 	QAction* actionModModeColor;
   338 	QAction* actionModModeXLink;
   339 	QAction* actionModModeCopy;
   340 
   341 	QActionGroup *actionGroupFormatFrameTypes;
   342 
   343 
   344 	QActionGroup *actionGroupFormatLinkStyles;
   345 	QAction *actionFormatLinkStyleLine;
   346 	QAction *actionFormatLinkStyleParabel;
   347 	QAction *actionFormatLinkStylePolyLine;
   348 	QAction *actionFormatLinkStylePolyParabel;
   349 	QAction *actionFormatHideLinkUnselected;
   350 
   351 	QAction *actionViewToggleNoteEditor;
   352 	QAction *actionViewToggleHistoryWindow;
   353 	QAction *actionViewTogglePropertyWindow;
   354 	QAction *actionViewToggleAntiAlias;
   355 	QAction *actionViewToggleSmoothPixmapTransform;
   356 	QAction* actionViewCenter;
   357 
   358 	QAction* actionSettingsAutoEditNewBranch;
   359 	QAction* actionSettingsAutoSelectNewBranch;
   360 	QAction* actionSettingsAutoSelectText;
   361 	QAction* actionSettingsUseDelKey;
   362 	QAction* actionSettingsUseFlagGroups;
   363 	QAction* actionSettingsUseHideExport;
   364 	QAction* actionSettingsAutosaveToggle;
   365 	QAction* actionSettingsAutosaveTime;
   366 	QAction* actionSettingsWriteBackupFile;
   367 	QAction* actionSettingsUseAnimation;
   368 };
   369 
   370 
   371 #endif
   372