mainwindow.h
author insilmaril
Wed, 21 Mar 2007 11:51:38 +0000
changeset 436 19e5907b7818
parent 434 c585be63ec69
child 442 dfbc371b7280
permissions -rw-r--r--
Slightly improved scripting abilities
     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 hideEvent (QHideEvent * );
    47 	void showEvent (QShowEvent * );
    48 	bool reallyWriteDirectory(const QString&);
    49 	QString browseDirectory(const QString&);
    50 	MapEditor* currentMapEditor() const;
    51     
    52 private slots:
    53 	void editorChanged(QWidget*);
    54 
    55     ErrorCode fileLoad(QString ,const LoadMode &);
    56     void fileLoad(const LoadMode &);
    57     void fileLoad();
    58 	void fileLoadRecent();
    59 	void addRecentMap (const QString &);
    60     void fileSave(const SaveMode & );
    61     void fileSave();
    62     void fileSaveAs(const SaveMode &);
    63     void fileSaveAs();
    64     void fileImportKDEBookmarks();
    65     void fileImportFirefoxBookmarks();
    66     void fileImportMM();
    67     void fileImportDir();
    68     void fileExportXML();
    69     void fileExportXHTML();
    70     void fileExportImage();
    71     void fileExportASCII();
    72     void fileExportLaTeX();
    73     void fileExportKDEBookmarks();
    74     void fileExportTaskjuggler();
    75     void fileExportOOPresentation();
    76     void fileCloseMap();
    77     void filePrint();
    78     void fileExitVYM();
    79 
    80 public slots:
    81     void editUndo();	
    82     void editRedo();	
    83 	void gotoHistoryStep (int);
    84 private slots:	
    85     void editCopy();	
    86     void editPaste();	
    87     void editCut();	
    88     void editOpenFindWindow();
    89 	void editFind(QString);
    90 	void editFindChanged();
    91 private:
    92 	void openTabs(QStringList);
    93 public slots:
    94 	void editOpenURL();
    95 	void editOpenURLTab();
    96 private slots:
    97 	void editOpenMultipleURLTabs();
    98 	void editURL();
    99 	void editHeading2URL();
   100 	void editBugzilla2URL();
   101 	void editFATE2URL();
   102 	void openVymLinks(const QStringList &);
   103 	void editVymLink();
   104 	void editOpenMultipleVymLinks();
   105     void editHeadingFinished();
   106 public slots:
   107     void editHeading();
   108 	void editOpenVymLink();
   109 private slots:
   110 	void editDeleteVymLink();
   111 	void editToggleHideExport();
   112 	void editMapInfo();
   113     void editMoveUp();	
   114     void editMoveDown();	
   115     void editToggleScroll();
   116     void editUnScrollAll();
   117     void editNewBranch();
   118     void editNewBranchBefore();
   119     void editNewBranchAbove();
   120     void editNewBranchBelow();
   121     void editImportAdd();
   122     void editImportReplace();
   123     void editSaveBranch();
   124     void editDeleteKeepChilds();
   125     void editDeleteChilds();
   126     void editDeleteSelection();
   127     void editUpperBranch();
   128     void editLowerBranch();
   129     void editLeftBranch();
   130     void editRightBranch();
   131     void editFirstBranch();
   132     void editLastBranch();
   133     void editLoadImage();
   134     void editSaveImage();
   135     void editFollowXLink (QAction *);
   136     void editEditXLink (QAction *);
   137 
   138     void formatSelectColor();
   139     void formatPickColor();
   140     void colorChanged(QColor);
   141     void formatColorBranch();
   142     void formatColorSubtree();
   143 	void formatLinkStyleLine();
   144 	void formatLinkStyleParabel();
   145 	void formatLinkStylePolyLine();
   146 	void formatLinkStylePolyParabel();
   147     void formatSelectBackColor();
   148     void formatSelectBackImage();
   149     void formatSelectLinkColor();
   150     void formatToggleLinkColorHint();
   151 	void formatIncludeImagesVer();
   152 	void formatIncludeImagesHor();
   153 	void formatHideLinkUnselected();
   154 
   155     void viewZoomReset();
   156     void viewZoomIn();
   157     void viewZoomOut();
   158 
   159 public slots:
   160 	bool settingsPDF();
   161 	bool settingsURL();
   162 	void settingsToggleDelKey();
   163 
   164 	void windowToggleNoteEditor();
   165 	void windowToggleHistory();
   166 	void updateHistory(SimpleSettings &);
   167 	void windowToggleAntiAlias();
   168 	void windowToggleSmoothPixmap();
   169 	void updateNoteFlag();
   170 	void updateActions();
   171 	ModMode getModMode();
   172 	bool autoEdit();
   173 	bool autoSelectHeading();
   174 	bool useFlagGroups();
   175 	void setScript(const QString &);
   176 	void runScript(const QString &);
   177 
   178 private slots:
   179 	void showPropertyDialog();
   180 	void windowNextEditor();
   181 	void windowPreviousEditor();
   182 	void windowShowNoteEditor();
   183 	void windowHideNoteEditor();
   184 
   185 	void standardFlagChanged();
   186 
   187     void testFunction();
   188     void testCommand();
   189 
   190     void helpDoc();
   191     void helpAbout();
   192     void helpAboutQT();
   193 
   194 private:
   195 	QTabWidget *tabWidget;
   196 	FindWindow *findWindow;
   197 	QProcess *procBrowser;
   198 
   199 	QStringList imageTypes;
   200 
   201 	QLineEdit *lineedit;	// to enter headings of branches
   202 	QString prevSelection;
   203 
   204 	HistoryWindow *historyWindow;
   205 
   206 	BranchPropertyWindow *branchPropertyWindow;
   207 	SimpleScriptEditor *scriptEditor;
   208 
   209 	QList <QAction*> actionListBranches;
   210 
   211 	QColor currentColor;
   212 
   213 	QMenu *recentFilesMenu;
   214 	enum { MaxRecentFiles = 9 };
   215     QAction *recentFileActs[MaxRecentFiles];
   216 
   217 	QAction* actionFileSave;
   218 	QAction* actionFilePrint;
   219 	QAction* actionEditUndo;
   220 	QAction* actionEditRedo;
   221 	QAction *actionEditCopy;
   222 	QAction *actionEditCut;
   223 	QAction *actionEditPaste;
   224 	QAction *actionEditMoveUp;
   225 	QAction *actionEditMoveDown;
   226 	QAction *actionEditToggleScroll;
   227 	QAction* actionEditOpenURL;
   228 	QAction* actionEditOpenURLTab;
   229 	QAction* actionEditOpenMultipleURLTabs;
   230 	QAction* actionEditURL;
   231 	QAction* actionEditHeading2URL;
   232 	QAction* actionEditBugzilla2URL;
   233 	QAction* actionEditFATE2URL;
   234 	QAction *actionEditOpenVymLink;
   235 	QAction *actionEditOpenMultipleVymLinks;
   236 	QAction *actionEditVymLink;
   237 	QAction *actionEditDeleteVymLink;
   238 	QAction *actionEditToggleHideExport;
   239 	QAction *actionEditMapInfo;
   240 	QAction *actionEditHeading;
   241 	QAction *actionEditDelete;
   242 	QAction *actionEditAddBranch;
   243 	QAction *actionEditAddBranchBefore;
   244 	QAction *actionEditAddBranchAbove;
   245 	QAction *actionEditAddBranchBelow;
   246 	QAction *actionEditDeleteKeepChilds;
   247 	QAction *actionEditDeleteChilds;
   248 	QAction *actionEditImportAdd;
   249 	QAction *actionEditImportReplace;
   250 	QAction *actionEditSaveBranch;
   251 	QAction *actionEditSelectFirst;
   252 	QAction *actionEditSelectLast;
   253 	QAction *actionEditLoadImage;
   254 
   255 	QAction* actionFormatColor;
   256 	QAction* actionFormatPickColor;
   257 	QAction* actionFormatColorBranch;
   258 	QAction* actionFormatColorSubtree;
   259 	QAction* actionFormatLinkColorHint;
   260 	QAction* actionFormatBackColor;
   261 	QAction* actionFormatBackImage;
   262 	QAction* actionFormatLinkColor;
   263 	QAction *actionFormatIncludeImagesVer;
   264 	QAction *actionFormatIncludeImagesHor;
   265 
   266 	QActionGroup* actionGroupModModes;
   267 	QAction* actionModModeColor;
   268 	QAction* actionModModeXLink;
   269 	QAction* actionModModeCopy;
   270 
   271 	QActionGroup *actionGroupFormatFrameTypes;
   272 
   273 	QAction *actionOpenPropertyDialog;
   274 
   275 	QActionGroup *actionGroupFormatLinkStyles;
   276 	QAction *actionFormatLinkStyleLine;
   277 	QAction *actionFormatLinkStyleParabel;
   278 	QAction *actionFormatLinkStylePolyLine;
   279 	QAction *actionFormatLinkStylePolyParabel;
   280 	QAction *actionFormatHideLinkUnselected;
   281 
   282 	QAction *actionViewToggleNoteEditor;
   283 	QAction *actionViewToggleHistoryWindow;
   284 	QAction *actionViewToggleAntiAlias;
   285 	QAction *actionViewToggleSmoothPixmapTransform;
   286 
   287 	QAction* actionSettingsAutoEdit;
   288 	QAction* actionSettingsAutoSelectHeading;
   289 	QAction* actionSettingsAutoSelectText;
   290 	QAction* actionSettingsUseDelKey;
   291 	QAction* actionSettingsUseFlagGroups;
   292 	QAction* actionSettingsUseHideExport;
   293 };
   294 
   295 
   296 #endif
   297