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