mainwindow.h
author insilmaril
Mon May 18 09:41:31 2009 +0000 (2009-05-18)
changeset 770 57ce1ba6d1cb
parent 767 6d2b32f305f9
child 772 e3f722759c7e
permissions -rw-r--r--
Fixed Standard Flags finally
     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 <VymModel*> tabModel;		//!< the corresponding model to a tab
   247 
   248 	QString prevSelection;
   249 
   250 	HistoryWindow *historyWindow;
   251 
   252 	BranchPropertyWindow *branchPropertyWindow;
   253 	SimpleScriptEditor *scriptEditor;
   254 
   255 	QList <QAction*> actionListBranches;
   256 
   257 	QColor currentColor;
   258 
   259 	int xLinkMenuWidth;
   260 
   261 	QMenu *recentFilesMenu;
   262 	enum { MaxRecentFiles = 9 };
   263     QAction *recentFileActions[MaxRecentFiles];
   264 
   265     QAction *macroActions[12];
   266 	QStringList macro;
   267 
   268 	QAction* actionFileNewCopy;
   269 	QAction* actionFileSave;
   270 	QAction* actionFilePrint;
   271 	QAction* actionUndo;
   272 	QAction* actionRedo;
   273 	QAction *actionCopy;
   274 	QAction *actionCut;
   275 	QAction *actionPaste;
   276 	QAction *actionMoveUp;
   277 	QAction *actionMoveDown;
   278 	QAction *actionSortChildren;
   279 	QAction *actionToggleScroll;
   280 	QAction *actionExpandAll;
   281 	QAction* actionOpenURL;
   282 	QAction* actionOpenURLTab;
   283 	QAction* actionOpenMultipleURLTabs;
   284 	QAction* actionURL;
   285 	QAction* actionLocalURL;
   286 	QAction* actionHeading2URL;
   287 	QAction* actionBugzilla2URL;
   288 	QAction* actionFATE2URL;
   289 	QAction *actionOpenVymLink;
   290 	QAction *actionOpenMultipleVymLinks;
   291 	QAction *actionVymLink;
   292 	QAction *actionDeleteVymLink;
   293 	QAction *actionToggleHideExport;
   294 	QAction *actionMapInfo;
   295 	QAction *actionHeading;
   296 	QAction *actionDelete;
   297 
   298 public:
   299 	QAction *actionAddMapCenter;
   300 
   301 private:	
   302 	QAction *actionAddBranch;
   303 	QAction *actionAddBranchBefore;
   304 	QAction *actionAddBranchAbove;
   305 	QAction *actionAddBranchBelow;
   306 	QAction *actionDeleteKeepChildren;
   307 	QAction *actionDeleteChildren;
   308 	QAction *actionImportAdd;
   309 	QAction *actionImportReplace;
   310 	QAction *actionSaveBranch;
   311 	QAction *actionLoadImage;
   312 
   313 	QAction* actionFormatColor;
   314 	QAction* actionFormatPickColor;
   315 	QAction* actionFormatColorBranch;
   316 	QAction* actionFormatColorSubtree;
   317 	QAction* actionFormatLinkColorHint;
   318 	QAction* actionFormatBackColor;
   319 	QAction* actionFormatBackImage;
   320 	QAction* actionFormatLinkColor;
   321 	QAction* actionFormatSelectionColor;
   322 
   323 	QActionGroup* actionGroupModModes;
   324 	QAction* actionModModeColor;
   325 	QAction* actionModModeXLink;
   326 	QAction* actionModModeCopy;
   327 
   328 	QActionGroup *actionGroupFormatFrameTypes;
   329 
   330 
   331 	QActionGroup *actionGroupFormatLinkStyles;
   332 	QAction *actionFormatLinkStyleLine;
   333 	QAction *actionFormatLinkStyleParabel;
   334 	QAction *actionFormatLinkStylePolyLine;
   335 	QAction *actionFormatLinkStylePolyParabel;
   336 	QAction *actionFormatHideLinkUnselected;
   337 
   338 	QAction *actionViewToggleNoteEditor;
   339 	QAction *actionViewToggleHistoryWindow;
   340 	QAction *actionViewTogglePropertyWindow;
   341 	QAction *actionViewToggleAntiAlias;
   342 	QAction *actionViewToggleSmoothPixmapTransform;
   343 	QAction* actionViewCenter;
   344 
   345 	QAction* actionSettingsAutoEditNewBranch;
   346 	QAction* actionSettingsAutoSelectNewBranch;
   347 	QAction* actionSettingsAutoSelectText;
   348 	QAction* actionSettingsUseDelKey;
   349 	QAction* actionSettingsUseFlagGroups;
   350 	QAction* actionSettingsUseHideExport;
   351 	QAction* actionSettingsAutosaveToggle;
   352 	QAction* actionSettingsAutosaveTime;
   353 	QAction* actionSettingsWriteBackupFile;
   354 	QAction* actionSettingsUseAnimation;
   355 };
   356 
   357 
   358 #endif
   359