2
0

mdichild.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*************************************************************************
  2. * Copyright (c) 2011 AT&T Intellectual Property
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * https://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors: Details at https://graphviz.org
  9. *************************************************************************/
  10. #pragma once
  11. #include <memory>
  12. #include <QTextEdit>
  13. #include "imageviewer.h"
  14. class CMainWindow;
  15. class MdiChild : public QTextEdit
  16. {
  17. Q_OBJECT
  18. public:
  19. MdiChild();
  20. void newFile();
  21. bool loadFile(const QString &fileName);
  22. bool save();
  23. bool saveAs();
  24. bool saveFile(const QString &fileName);
  25. QString userFriendlyCurrentFile();
  26. QString currentFile() { return curFile; }
  27. int layoutIdx;
  28. int renderIdx;
  29. QString outputFile;
  30. bool preview;
  31. bool applyCairo;
  32. QString attributes;
  33. std::unique_ptr<ImageViewer> previewFrm;
  34. CMainWindow* parentFrm;
  35. bool loadPreview(const QString &fileName);
  36. bool firstTime();
  37. bool settingsSet;
  38. protected:
  39. void closeEvent(QCloseEvent *event);
  40. private slots:
  41. void documentWasModified();
  42. private:
  43. bool maybeSave();
  44. void setCurrentFile(const QString &fileName);
  45. QString strippedName(const QString &fullFileName);
  46. QString curFile;
  47. bool isUntitled;
  48. };