mainwindow.h
author insilmaril
Mon, 22 Mar 2010 15:37:23 +0000
changeset 841 46553c106c52
parent 837 5ecd0462f76b
child 842 bec082472471
permissions -rw-r--r--
Fixes for QLineEdit and moving vym.changelog up one level
     1 #ifndef MAINWINDOW_H 
     2 #define MAINWINDOW_H
     3 
     4 #include <QMainWindow>
     5 #include <QtDBus>
     6 
     7 
     8 #include "branchpropwindow.h"
     9 #include "extrainfodialog.h"
    10 #include "flag.h"
    11 #include "file.h"
    12 #include "historywindow.h"
    13 #include "mapeditor.h"
    14 #include "shortcuts.h"
    15 #include "simplescripteditor.h"
    16 #include "texteditor.h"
    17 #include "vymview.h"
    18 
    19 class Main : public QMainWindow 
    20 {
    21     Q_OBJECT
    22 
    23 public:
    24 	/*! Modifier modes are used when CTRL together with a mouse button is pressed */
    25 	enum ModMode {
    26 		ModModeNone,	//!< Unused
    27 		ModModeColor,	//!< Pick color from object
    28 		ModModeCopy,	//!< Copy object
    29 		ModModeXLink	//!< Create a XLink (XLinkObj) from selected object
    30 		};
    31 
    32     Main(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
    33     ~Main();
    34 	void loadCmdLine();
    35 
    36 private:
    37 	QProgressDialog progressDialog;
    38 	int progressMax;
    39 	int progressMin;
    40 	int progressCounter;
    41 	int progressCounterTotal;
    42 public:	
    43 	void statusMessage (const QString &);
    44 	void setProgressMaximum (int max);
    45 	void addProgressValue (float v);
    46 	void setProgressCounter (int v);
    47 	void removeProgressCounter();
    48 
    49 public slots:
    50     void fileNew();
    51     void fileNewCopy();
    52 
    53 protected:
    54 	void closeEvent( QCloseEvent* );
    55 
    56 private:
    57     void setupFileActions();
    58     void setupEditActions();
    59     void setupFormatActions();
    60     void setupViewActions();
    61     void setupModeActions();
    62     void setupWindowActions();
    63     void setupFlag(Flag *flag, QToolBar *tb, const QString &name, const QString &tooltip);
    64     void setupFlagActions();
    65     void setupNetworkActions();
    66     void setupSettingsActions();
    67     void setupTestActions();
    68     void setupHelpActions();
    69     void setupContextMenus();
    70 	void setupRecentMapsMenu();
    71     void setupMacros();
    72 	void hideEvent (QHideEvent * );
    73 	void showEvent (QShowEvent * );
    74 	MapEditor* currentMapEditor() const;
    75 	VymModel* currentModel() const;
    76 public:	
    77 	uint currentModelID() const;
    78 	VymModel* getModel(uint) const;
    79     
    80 private slots:
    81 	void editorChanged(QWidget*);
    82 
    83     ErrorCode fileLoad(QString ,const LoadMode &, const FileType & ftype=VymMap);
    84     void fileLoad(const LoadMode &);
    85     void fileLoad();
    86 	void fileLoadRecent();
    87 	void addRecentMap (const QString &);
    88     void fileSave(VymModel*, const SaveMode & );
    89     void fileSave();
    90 public slots:	
    91     void fileSave(VymModel*);	// autosave from MapEditor
    92 private slots:	
    93     void fileSaveAs(const SaveMode &);
    94     void fileSaveAs();
    95     void fileImportKDE3Bookmarks();
    96     void fileImportKDE4Bookmarks();
    97     void fileImportFirefoxBookmarks();
    98     void fileImportFreemind();
    99     void fileImportMM();
   100     void fileImportDir();
   101     void fileExportXML();
   102     void fileExportHTML();
   103     void fileExportXHTML();
   104     void fileExportImage();
   105     void fileExportAO();
   106     void fileExportASCII();
   107     void fileExportCSV();
   108     void fileExportLaTeX();
   109     void fileExportKDE3Bookmarks();
   110     void fileExportKDE4Bookmarks();
   111     void fileExportTaskjuggler();
   112     void fileExportOOPresentation();
   113     void fileCloseMap();
   114     void filePrint();
   115     void fileExitVYM();
   116 
   117 public slots:
   118     void editUndo();	
   119     void editRedo();	
   120 	void gotoHistoryStep (int);
   121 private slots:	
   122     void editCopy();	
   123     void editPaste();	
   124     void editCut();	
   125     void editOpenFindWidget();
   126     void editHideFindWidget();
   127 	void editFindNext(QString s);
   128     void editFindDuplicateURLs();
   129 private:
   130 	void openTabs(QStringList);
   131 public slots:
   132 	void editOpenURL();
   133 	void editOpenURLTab();
   134 private slots:
   135 	void editOpenMultipleVisURLTabs(bool ignoreScrolled=true);
   136 	void editOpenMultipleURLTabs();
   137 	void editURL();
   138 	void editLocalURL();
   139 	void editHeading2URL();
   140 	void editBugzilla2URL();
   141 	void getBugzillaData();
   142 	void editFATE2URL();
   143 	void openVymLinks(const QStringList &);
   144 	void editVymLink();
   145 	void editOpenMultipleVymLinks();
   146 public slots:
   147     void editHeadingFinished(VymModel *m);
   148 //    void editHeading();
   149 	void editOpenVymLink();
   150 private slots:
   151 	void editDeleteVymLink();
   152 	void editToggleHideExport();
   153 	void editAddTimestamp();
   154 	void editMapInfo();
   155     void editMoveUp();	
   156     void editMoveDown();	
   157     void editDetach();	
   158 	void editSortChildren();
   159 	void editSortBackChildren();
   160     void editToggleScroll();
   161     void editExpandAll();
   162     void editExpandOneLevel();
   163     void editCollapseOneLevel();
   164     void editUnscrollChildren();
   165     void editAddAttribute();
   166     void editAddMapCenter();
   167     void editNewBranch();
   168     void editNewBranchBefore();
   169     void editNewBranchAbove();
   170     void editNewBranchBelow();
   171     void editImportAdd();
   172     void editImportReplace();
   173     void editSaveBranch();
   174     void editDeleteKeepChildren();
   175     void editDeleteChildren();
   176     void editDeleteSelection();
   177     void editLoadImage();
   178     void editSaveImage();
   179     void editEditXLink (QAction *);
   180 
   181     void formatSelectColor();
   182     void formatPickColor();
   183     void colorChanged(QColor);
   184     void formatColorBranch();
   185     void formatColorSubtree();
   186 	void formatLinkStyleLine();
   187 	void formatLinkStyleParabel();
   188 	void formatLinkStylePolyLine();
   189 	void formatLinkStylePolyParabel();
   190     void formatSelectBackColor();
   191     void formatSelectBackImage();
   192     void formatSelectLinkColor();
   193     void formatSelectSelectionColor();
   194     void formatToggleLinkColorHint();
   195 	void formatHideLinkUnselected();
   196 
   197 public slots:
   198     void viewZoomReset();
   199     void viewZoomIn();
   200     void viewZoomOut();
   201     void viewCenter();
   202 
   203 public slots:
   204 	void networkStartServer();
   205 	void networkConnect();
   206 	bool settingsPDF();
   207 	bool settingsURL();
   208 	void settingsMacroDir();
   209 	void settingsToggleDelKey();
   210 	void settingsUndoLevels();
   211 	void settingsAutosaveToggle();
   212 	void settingsAutosaveTime();
   213 	void settingsAutoLayoutToggle();
   214 	void settingsWriteBackupFileToggle();
   215 	void settingsToggleAnimation();
   216 
   217 	void windowToggleNoteEditor();
   218 	void windowToggleTreeEditor();
   219 	void windowToggleHistory();
   220 	void windowToggleProperty();
   221 	void updateHistory(SimpleSettings &);
   222 	void windowToggleAntiAlias();
   223 public:
   224 	bool isAliased();
   225 	bool hasSmoothPixmapTransform();
   226 public slots:
   227 	void windowToggleSmoothPixmap();
   228 	void updateNoteFlag();
   229 	void updateNoteEditor (QModelIndex index);
   230 	void changeSelection (VymModel *model,const QItemSelection &newSel, const QItemSelection &delSel);
   231 
   232 	void updateActions();
   233 	ModMode getModMode();
   234 	bool autoEditNewBranch();
   235 	bool autoSelectNewBranch();
   236 	void setScript(const QString &);
   237 	void runScript(const QString &);
   238 	void runScriptEverywhere (const QString &);
   239 
   240 private slots:
   241 	void windowNextEditor();
   242 	void windowPreviousEditor();
   243 	void windowShowNoteEditor();
   244 	void windowHideNoteEditor();
   245 
   246 	void standardFlagChanged();
   247 
   248     void testFunction1();
   249     void testFunction2();
   250     void testCommand();
   251 
   252     void helpDoc();
   253     void helpDemo();
   254     void helpAbout();
   255     void helpAboutQT();
   256 
   257 	void callMacro ();
   258 
   259 private:
   260 	QTabWidget *tabWidget;
   261 	QProcess *procBrowser;		//FIXME-2 remove this...
   262 	qint64 *browserPID;
   263 
   264 	QStringList imageTypes;
   265 
   266 	QList <VymView*> vymViews;		//! Keeps track of models and views related to a tab 
   267 	QString prevSelection;
   268 
   269 	HistoryWindow *historyWindow;
   270 
   271 	BranchPropertyWindow *branchPropertyWindow;
   272 	SimpleScriptEditor *scriptEditor;
   273 
   274 	QList <QAction*> actionListBranches;
   275 
   276 	QColor currentColor;
   277 
   278 	int xLinkMenuWidth;
   279 
   280 	QMenu *recentFilesMenu;
   281 	enum { MaxRecentFiles = 9 };
   282     QAction *recentFileActions[MaxRecentFiles];
   283 
   284     QAction *macroActions[12];
   285 	QStringList macro;
   286 
   287 	Switchboard switchboard;
   288 
   289 	QAction* actionFileNewCopy;
   290 	QAction* actionFileSave;
   291 	QAction* actionFilePrint;
   292 	QAction* actionUndo;
   293 	QAction* actionRedo;
   294 	QAction *actionCopy;
   295 	QAction *actionCut;
   296 	QAction *actionPaste;
   297 	QAction *actionMoveUp;
   298 	QAction *actionMoveDown;
   299 	QAction *actionDetach;
   300 	QAction *actionSortChildren;
   301 	QAction *actionSortBackChildren;
   302 	QAction *actionToggleScroll;
   303 	QAction *actionExpandAll;
   304 	QAction *actionExpandOneLevel;
   305 	QAction *actionCollapseOneLevel;
   306 	QAction* actionOpenURL;
   307 	QAction* actionOpenURLTab;
   308 	QAction* actionOpenMultipleVisURLTabs;
   309 	QAction* actionOpenMultipleURLTabs;
   310 	QAction* actionURL;
   311 	QAction* actionLocalURL;
   312 	QAction* actionHeading2URL;
   313 	QAction* actionBugzilla2URL;
   314 	QAction* actionGetBugzillaData;
   315 	QAction* actionFATE2URL;
   316 	QAction *actionOpenVymLink;
   317 	QAction *actionOpenMultipleVymLinks;
   318 	QAction *actionVymLink;
   319 	QAction *actionDeleteVymLink;
   320 	QAction *actionAddTimestamp;
   321 	QAction *actionToggleHideExport;
   322 	QAction *actionMapInfo;
   323 	QAction *actionHeading;
   324 	QAction *actionDelete;
   325 	QAction *actionAddAttribute;
   326 public:
   327 	QAction *actionAddMapCenter;
   328 
   329 private:	
   330 	QAction *actionAddBranch;
   331 	QAction *actionAddBranchBefore;
   332 	QAction *actionAddBranchAbove;
   333 	QAction *actionAddBranchBelow;
   334 	QAction *actionDeleteKeepChildren;
   335 	QAction *actionDeleteChildren;
   336 	QAction *actionImportAdd;
   337 	QAction *actionImportReplace;
   338 	QAction *actionSaveBranch;
   339 	QAction *actionLoadImage;
   340 
   341 	QAction* actionFormatColor;
   342 	QAction* actionFormatPickColor;
   343 	QAction* actionFormatColorBranch;
   344 	QAction* actionFormatColorSubtree;
   345 	QAction* actionFormatLinkColorHint;
   346 	QAction* actionFormatBackColor;
   347 	QAction* actionFormatBackImage;
   348 	QAction* actionFormatLinkColor;
   349 	QAction* actionFormatSelectionColor;
   350 
   351 	QActionGroup* actionGroupModModes;
   352 	QAction* actionModModeColor;
   353 	QAction* actionModModeXLink;
   354 	QAction* actionModModeCopy;
   355 
   356 	QActionGroup *actionGroupFormatFrameTypes;
   357 
   358 
   359 	QActionGroup *actionGroupFormatLinkStyles;
   360 	QAction *actionFormatLinkStyleLine;
   361 	QAction *actionFormatLinkStyleParabel;
   362 	QAction *actionFormatLinkStylePolyLine;
   363 	QAction *actionFormatLinkStylePolyParabel;
   364 	QAction *actionFormatHideLinkUnselected;
   365 
   366 	QAction *actionViewToggleNoteEditor;
   367 	QAction *actionViewToggleTreeEditor;
   368 	QAction *actionViewToggleHistoryWindow;
   369 	QAction *actionViewTogglePropertyWindow;
   370 	QAction *actionViewToggleAntiAlias;
   371 	QAction *actionViewToggleSmoothPixmapTransform;
   372 	QAction* actionViewCenter;
   373 
   374 	QAction* actionSettingsAutoEditNewBranch;
   375 	QAction* actionSettingsAutoSelectNewBranch;
   376 	QAction* actionSettingsAutoSelectText;
   377 	QAction* actionSettingsUseDelKey;
   378 	QAction* actionSettingsUseFlagGroups;
   379 	QAction* actionSettingsUseHideExport;
   380 	QAction* actionSettingsAutosaveToggle;
   381 	QAction* actionSettingsAutosaveTime;
   382 	QAction* actionSettingsAutoLayoutToggle;
   383 	QAction* actionSettingsWriteBackupFile;
   384 	QAction* actionSettingsUseAnimation;
   385 };
   386 
   387 
   388 #endif
   389