mainwindow.h
author insilmaril
Tue, 10 Apr 2007 13:22:55 +0000
changeset 449 5378ed53ec92
parent 445 0796c5592f00
child 450 beb875135811
permissions -rw-r--r--
1.8.71 Basic support for macros
     1 #ifndef MAINWINDOW_H 
     2 #define MAINWINDOW_H
     3 
     4 #include <QMainWindow>
     5 
     6 #include "branchpropwindow.h"
     7 #include "file.h"
     8 #include "findwindow.h"
     9 #include "historywindow.h"
    10 #include "mapeditor.h"
    11 #include "simplescripteditor.h"
    12 #include "texteditor.h"
    13 #include "xml.h"
    14 
    15 enum ModMode {ModModeNone,ModModeColor,ModModeCopy,ModModeXLink};
    16 
    17 class Main : public QMainWindow 
    18 {
    19     Q_OBJECT
    20 
    21 public:
    22     Main(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
    23     ~Main();
    24 	void loadCmdLine();
    25 	void statusMessage (const QString &);
    26 
    27 public slots:
    28     void fileNew();
    29 
    30 protected:
    31 	void closeEvent( QCloseEvent* );
    32 
    33 private:
    34     void setupFileActions();
    35     void setupEditActions();
    36     void setupFormatActions();
    37     void setupViewActions();
    38     void setupModeActions();
    39     void setupWindowActions();
    40     void setupFlagActions();
    41     void setupSettingsActions();
    42     void setupTestActions();
    43     void setupHelpActions();
    44     void setupContextMenus();
    45 	void setupRecentMapsMenu();
    46     void setupMacros();
    47 	void hideEvent (QHideEvent * );
    48 	void showEvent (QShowEvent * );
    49 	bool reallyWriteDirectory(const QString&);
    50 	QString browseDirectory(const QString&);
    51 	MapEditor* currentMapEditor() const;
    52     
    53 private slots:
    54 	void editorChanged(QWidget*);
    55 
    56     ErrorCode fileLoad(QString ,const LoadMode &);
    57     void fileLoad(const LoadMode &);
    58     void fileLoad();
    59 	void fileLoadRecent();
    60 	void addRecentMap (const QString &);
    61     void fileSave(const SaveMode & );
    62     void fileSave();
    63     void fileSaveAs(const SaveMode &);
    64     void fileSaveAs();
    65     void fileImportKDEBookmarks();
    66     void fileImportFirefoxBookmarks();
    67     void fileImportMM();
    68     void fileImportDir();
    69     void fileExportXML();
    70     void fileExportXHTML();
    71     void fileExportImage();
    72     void fileExportASCII();
    73     void fileExportLaTeX();
    74     void fileExportKDEBookmarks();
    75     void fileExportTaskjuggler();
    76     void fileExportOOPresentation();
    77     void fileCloseMap();
    78     void filePrint();
    79     void fileExitVYM();
    80 
    81 public slots:
    82     void editUndo();	
    83     void editRedo();	
    84 	void gotoHistoryStep (int);
    85 private slots:	
    86     void editCopy();	
    87     void editPaste();	
    88     void editCut();	
    89     void editOpenFindWindow();
    90 	void editFind(QString);
    91 	void editFindChanged();
    92 private:
    93 	void openTabs(QStringList);
    94 public slots:
    95 	void editOpenURL();
    96 	void editOpenURLTab();
    97 private slots:
    98 	void editOpenMultipleURLTabs();
    99 	void editURL();
   100 	void editHeading2URL();
   101 	void editBugzilla2URL();
   102 	void editFATE2URL();
   103 	void openVymLinks(const QStringList &);
   104 	void editVymLink();
   105 	void editOpenMultipleVymLinks();
   106     void editHeadingFinished();
   107 public slots:
   108     void editHeading();
   109 	void editOpenVymLink();
   110 private slots:
   111 	void editDeleteVymLink();
   112 	void editToggleHideExport();
   113 	void editMapInfo();
   114     void editMoveUp();	
   115     void editMoveDown();	
   116     void editToggleScroll();
   117     void editUnScrollAll();
   118     void editNewBranch();
   119     void editNewBranchBefore();
   120     void editNewBranchAbove();
   121     void editNewBranchBelow();
   122     void editImportAdd();
   123     void editImportReplace();
   124     void editSaveBranch();
   125     void editDeleteKeepChilds();
   126     void editDeleteChilds();
   127     void editDeleteSelection();
   128     void editUpperBranch();
   129     void editLowerBranch();
   130     void editLeftBranch();
   131     void editRightBranch();
   132     void editFirstBranch();
   133     void editLastBranch();
   134     void editLoadImage();
   135     void editSaveImage();
   136     void editFollowXLink (QAction *);
   137     void editEditXLink (QAction *);
   138 
   139     void formatSelectColor();
   140     void formatPickColor();
   141     void colorChanged(QColor);
   142     void formatColorBranch();
   143     void formatColorSubtree();
   144 	void formatLinkStyleLine();
   145 	void formatLinkStyleParabel();
   146 	void formatLinkStylePolyLine();
   147 	void formatLinkStylePolyParabel();
   148     void formatSelectBackColor();
   149     void formatSelectBackImage();
   150     void formatSelectLinkColor();
   151     void formatSelectSelectionColor();
   152     void formatToggleLinkColorHint();
   153 	void formatIncludeImagesVer();
   154 	void formatIncludeImagesHor();
   155 	void formatHideLinkUnselected();
   156 
   157     void viewZoomReset();
   158     void viewZoomIn();
   159     void viewZoomOut();
   160 
   161 public slots:
   162 	bool settingsPDF();
   163 	bool settingsURL();
   164 	void settingsToggleDelKey();
   165 
   166 	void windowToggleNoteEditor();
   167 	void windowToggleHistory();
   168 	void updateHistory(SimpleSettings &);
   169 	void windowToggleAntiAlias();
   170 	void windowToggleSmoothPixmap();
   171 	void updateNoteFlag();
   172 	void updateSatellites(MapEditor *);
   173 	void updateActions();
   174 	ModMode getModMode();
   175 	bool autoEdit();
   176 	bool autoSelectHeading();
   177 	bool useFlagGroups();
   178 	void setScript(const QString &);
   179 	void runScript(const QString &);
   180 
   181 private slots:
   182 	void showPropertyDialog();
   183 	void windowNextEditor();
   184 	void windowPreviousEditor();
   185 	void windowShowNoteEditor();
   186 	void windowHideNoteEditor();
   187 
   188 	void standardFlagChanged();
   189 
   190     void testFunction();
   191     void testCommand();
   192 
   193     void helpDoc();
   194     void helpAbout();
   195     void helpAboutQT();
   196 
   197 	void callMacro ();
   198 private:
   199 	QTabWidget *tabWidget;
   200 	FindWindow *findWindow;
   201 	QProcess *procBrowser;
   202 
   203 	QStringList imageTypes;
   204 
   205 	QLineEdit *lineedit;	// to enter headings of branches
   206 	QString prevSelection;
   207 
   208 	HistoryWindow *historyWindow;
   209 
   210 	BranchPropertyWindow *branchPropertyWindow;
   211 	SimpleScriptEditor *scriptEditor;
   212 
   213 	QList <QAction*> actionListBranches;
   214 
   215 	QColor currentColor;
   216 
   217 	QMenu *recentFilesMenu;
   218 	enum { MaxRecentFiles = 9 };
   219     QAction *recentFileActions[MaxRecentFiles];
   220 
   221     QAction *macroActions[12];
   222 	QStringList macro;
   223 
   224 	QAction* actionFileSave;
   225 	QAction* actionFilePrint;
   226 	QAction* actionEditUndo;
   227 	QAction* actionEditRedo;
   228 	QAction *actionEditCopy;
   229 	QAction *actionEditCut;
   230 	QAction *actionEditPaste;
   231 	QAction *actionEditMoveUp;
   232 	QAction *actionEditMoveDown;
   233 	QAction *actionEditToggleScroll;
   234 	QAction* actionEditOpenURL;
   235 	QAction* actionEditOpenURLTab;
   236 	QAction* actionEditOpenMultipleURLTabs;
   237 	QAction* actionEditURL;
   238 	QAction* actionEditHeading2URL;
   239 	QAction* actionEditBugzilla2URL;
   240 	QAction* actionEditFATE2URL;
   241 	QAction *actionEditOpenVymLink;
   242 	QAction *actionEditOpenMultipleVymLinks;
   243 	QAction *actionEditVymLink;
   244 	QAction *actionEditDeleteVymLink;
   245 	QAction *actionEditToggleHideExport;
   246 	QAction *actionEditMapInfo;
   247 	QAction *actionEditHeading;
   248 	QAction *actionEditDelete;
   249 	QAction *actionEditAddBranch;
   250 	QAction *actionEditAddBranchBefore;
   251 	QAction *actionEditAddBranchAbove;
   252 	QAction *actionEditAddBranchBelow;
   253 	QAction *actionEditDeleteKeepChilds;
   254 	QAction *actionEditDeleteChilds;
   255 	QAction *actionEditImportAdd;
   256 	QAction *actionEditImportReplace;
   257 	QAction *actionEditSaveBranch;
   258 	QAction *actionEditSelectFirst;
   259 	QAction *actionEditSelectLast;
   260 	QAction *actionEditLoadImage;
   261 
   262 	QAction* actionFormatColor;
   263 	QAction* actionFormatPickColor;
   264 	QAction* actionFormatColorBranch;
   265 	QAction* actionFormatColorSubtree;
   266 	QAction* actionFormatLinkColorHint;
   267 	QAction* actionFormatBackColor;
   268 	QAction* actionFormatBackImage;
   269 	QAction* actionFormatLinkColor;
   270 	QAction* actionFormatSelectionColor;
   271 	QAction *actionFormatIncludeImagesVer;
   272 	QAction *actionFormatIncludeImagesHor;
   273 
   274 	QActionGroup* actionGroupModModes;
   275 	QAction* actionModModeColor;
   276 	QAction* actionModModeXLink;
   277 	QAction* actionModModeCopy;
   278 
   279 	QActionGroup *actionGroupFormatFrameTypes;
   280 
   281 	QAction *actionTogglePropertyDialog;
   282 
   283 	QActionGroup *actionGroupFormatLinkStyles;
   284 	QAction *actionFormatLinkStyleLine;
   285 	QAction *actionFormatLinkStyleParabel;
   286 	QAction *actionFormatLinkStylePolyLine;
   287 	QAction *actionFormatLinkStylePolyParabel;
   288 	QAction *actionFormatHideLinkUnselected;
   289 
   290 	QAction *actionViewToggleNoteEditor;
   291 	QAction *actionViewToggleHistoryWindow;
   292 	QAction *actionViewToggleAntiAlias;
   293 	QAction *actionViewToggleSmoothPixmapTransform;
   294 
   295 	QAction* actionSettingsAutoEdit;
   296 	QAction* actionSettingsAutoSelectHeading;
   297 	QAction* actionSettingsAutoSelectText;
   298 	QAction* actionSettingsUseDelKey;
   299 	QAction* actionSettingsUseFlagGroups;
   300 	QAction* actionSettingsUseHideExport;
   301 };
   302 
   303 
   304 #endif
   305